powerGateServer uses Apache log4net as core logging library, and additionally PostSharp Diagnostics for extended Debug logging.

By default, all the logs are stored in the Windows Event Log and it contains only Warnings and Errors.
You can use the Microsoft Event Viewer to watch them.
By clicking shortcut powerGateServer Logs from Start-Menu in powerGateServer-section, automatically the EventViewer is launchend for the Log cOpowerGateServer

Additionally you can integrate the logging mechanism into your administrative environment by using the Windows Event Log.

The log4net settings file is located in C:\Program Files\coolOrange\powerGateServer\powerGateServer.log4net.
Further information about log4Net Configurations can be found here.

When to change the logging behavior?

When you have issues or when you want to get a more detailed knowledge about what went wrong, you can increase the loglevel.

When changing the loglevel to DEBUG PostSharp Diagnostics will be enabled and will log all the function calls into the log files. This could cause performance issues

Windows Event Log

You can see, that there are multiple logging-Appenders used. If you want to change the behavior for the EventLog, please visit following appender:

<appender name="EventLogAppender" type="log4net.Appender.EventLogAppender" >
In the following lines, you can configure the logginglevel for multiple loggers. You could set the level to “DEBUG”, than all the appenders will log in debug.
	<level value="INFO" />
	<appender-ref ref="EventLogAppender" />
	<appender-ref ref="ColoredConsoleAppender" />

In the lines

<filter type="log4net.Filter.LevelRangeFilter">
   <levelMin value="WARN" />
   <levelMax value="FATAL" />
you can change the level range from “DEBUG” to “FATAL”, then all the levels between the range Debug and Fatal will be logged.

In the following line you can configure the Event-Source of Event-Logs.

<param name="ApplicationName" value="powerGateServer-Service" />

Logging for Plugins

In order to enable logging and make use of log4net in your plugin, reference the coolOrange.Logging.dll from the powerGateServer installtion directory in your plugin.

Because powerGateServer makes use of the coolOrange.Logging library already, please specify to not copy the assembly to your plugins output directory!

In order to use the logger in your classes, initialize the Log instance and consume it:

using powerGateServer.SDK;
using log4net;
using System.Reflection;

namespace HelloWorldServices
	public class MyFirstWebService : WebService
		private static readonly ILog Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);

		public MyFirstWebService()
			Log.Info("MyFirstWebService is logging, yeahh!");

By launching powerGateServer in Console-Mode you should see the previous message in the DOS-Box.
By restarting the service, you can't find the previous log message in the EventLog jet, since the INFO level is not configured for the according appender in the configuration file.

Optional: If you would like to extend or adjust the logging configuration specially for your plugin, add a new appender for your plugins namespace to the end of the configuration file:

<logger name="HelloWorldServices">
	<!-- specify file appenders or overwrite prefered log level here -->
By doing this you can add your own RollingFileAppender (find example) or add another Windows event log appender with different log level settings etc.