Skip to main content
Tweeted twitter.com/StackTridion/status/843166364877668353
added 508 characters in body
Source Link
polonskyg
  • 801
  • 4
  • 12

UPDATE

Already tried to change the Tridion.ContentManager.Config file and add a new listener like this:

 <add switchValue="All" name="Tridion.Logging.LoggingCategory.Tracing">
    <listeners>
      <add name="Trace File" />
    </listeners>
 </add>

and writing something like this in code:

        Tridion.Logging.Logger.Write("DllTest", "DllTest", Tridion.Logging.LoggingCategory.Tracing, TraceEventType.Error);

But didn't work either. Nothing is logged.

UPDATE

Already tried to change the Tridion.ContentManager.Config file and add a new listener like this:

 <add switchValue="All" name="Tridion.Logging.LoggingCategory.Tracing">
    <listeners>
      <add name="Trace File" />
    </listeners>
 </add>

and writing something like this in code:

        Tridion.Logging.Logger.Write("DllTest", "DllTest", Tridion.Logging.LoggingCategory.Tracing, TraceEventType.Error);

But didn't work either. Nothing is logged.

Source Link
polonskyg
  • 801
  • 4
  • 12

ECL connector not logging in Web8

I'm using a custom ECL connector, similar to the Flickr example that can be found here

My problem is that I'm trying to log something to either EventViewer, File System, with Tridion Logger, nothing seems to be working. I recompile my dll, uploaded in the server, I even restart it and nothing in any of those places.

I'm using something like to log:

namespace MyProvider
{
    using System;
    using System.Diagnostics;
    using System.IO;

    using Tridion.ExternalContentLibrary.V2;

    public class EventViewerWriter : EventLog
    {
        private const string LOG_SourceName = "Tridion";

        private const string LOG_SysLogName = "Application";

        private bool _isInitialized = false;

        public EventViewerWriter()
            : base()
        {
            this.Initialize();
        }

        public void Initialize()
        {
            if (this._isInitialized)
            {
                return;
            }

            this.BeginInit();
            this.EndInit();

            if (!SourceExists(LOG_SourceName))
            {
                CreateEventSource(LOG_SourceName, LOG_SysLogName);
            }

            this.Source = LOG_SourceName;
            this.Log = LOG_SysLogName;
            this._isInitialized = true;
        }

        public void Write(string eventWritten)
        {
            try
            {
                System.Diagnostics.Trace.Write(eventWritten + " tracing id");
            }
            catch (Exception)
            {
            }

            try
            {
                // Tridion Logger
                Provider.HostServices.LogMessage(LoggingSeverity.Warning, eventWritten);
            }
            catch (Exception)
            {
            }

            try
            {
                this.WriteEntry(DateTime.Now + " - " + eventWritten, EventLogEntryType.Error);
            }
            catch (Exception)
            {
            }

            try
            {
                var currentDir = Path.GetDirectoryName(Environment.CurrentDirectory);
                var filePath = Path.Combine(currentDir, "Test.txt");

                // File System    
                using (var file = new StreamWriter(filePath))
                {
                    file.WriteLine(DateTime.Now + " - " + eventWritten);
                }
            }
            catch (Exception)
            {
            }
        }
    }
}

Note: I know I should not use empty catch, but it's a way here only to log in all cases.