Let's talk about how to enable logging in to the Plastic SCM client / server for debugging.
The client logging mechanism can be triggered by adding two logging configuration files into the plasticscm\client directory. This logs the operations performed by the client GUI plastic.exe or the CLI cm.exe.
plastic.log.conf
in the
directory where plastic.exe is located. You can download a sample of the configuration file for logging
here
.
plastic.log.conf
file and customize the output file value:
from
<file value="plastic" />
to
<file value="${HOME}/.plastic4/plastic.log.txt" />
from
<file value="plastic" />
to
<file value="${LOCALAPPDATA}\plastic4\logs\plastic.log.txt" />
plastic.log.txt
is
generated in the specified path.
cm.log.conf
in the directory where the
cm.exe resides. You can download a sample of the configuration file for logging
here
.
cm.log.conf
file and customize the output file value:
from
<file value="cm.log.txt" />
to
<file value="${HOME}/.plastic4/cm.log.txt" />
from
<file value="cm.log.txt" />
to
<file value="${LOCALAPPDATA}\plastic4\logs\cm.log.txt" />
cm.log.txt
in the specified directory.
Note: If you need to log more than one cm processes, you must add the
type="log4net.Util.PatternString"
pair to the file
key:
<file type="log4net.Util.PatternString" value="${LOCALAPPDATA}\plastic4\logs\cm-%processid.log.txt" />
When done performing your debugging operations and generating the logs for the client, you should deactivate
the logging mechanism so as to not affect the performance in any way. This can be achieved simply by renaming
the logging configuration files plastic.log.conf
and
cm.log.conf
. For example, you could call them plastic.log.conf.bck
and cm.log.conf.bck.
The server already comes with logging activated by means of a logging configuration file called
loader.log.conf
that can be found in the plasticscm\server directory. When the
Plastic SCM server starts, a log file called loader.log.txt
is generated in the
same directory as the server.
loader.log.txt
, and restart the Plastic server.
INFO
which dumps lightest level of debug
information to DEBUG
which dumps more debug information.
See an example below:
<level value="DEBUG" />
DEBUG
level in the server to be used ONLY for debugging and extracting some logs in short
period of time, and should be relaxed back to its former value while the server is used in production, since
it can slightly affect Plastic server performance.
DEBUG
level can be increased or relaxed on the fly by editing the level value parameters.
Plastic uses log4net as logging mechanism. It is very flexible when it comes to customizing and logging messages and output. The script below shows how to configure the log (editing loader.log.conf at server's directory) to output errors to the Windows Event Log.
<log4net> <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender"> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%message%newline" /> </layout> </appender> <appender name="FileAppender" type="log4net.Appender.FileAppender"> <file value="loader.log.txt" /> <appendToFile value="true" /> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%message%newline" /> </layout> </appender> <appender name="EventLogAppender" type="log4net.Appender.EventLogAppender" > <threshold value="ERROR" /> <applicationName value="Plastic Server" /> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%message%newline" /> </layout> </appender> <logger name="UpdatePerf"> <level value="INFO" /> </logger> <logger name="Transaction"> <level value="INFO" /> </logger> <logger name="Operations"> <level value="INFO" /> </logger> <root> <level value="ERROR" /> <appender-ref ref="FileAppender" /> <appender-ref ref="EventLogAppender" /> </root> </log4net>
The sample also shows how to configure Plastic logging to work with selected sources. In this case, we're selecting all the transaction, performance, and operations sources. We normally use the following conversion pattern to define appenders:
<conversionPattern value="%date %property{TransactionID} %property{ClientMachine} %-5level %logger - %message%newline" />