Enabling logging for Plastic SCM

Let's talk about how to enable logging in to the Plastic SCM client / server for debugging.

Plastic SCM client logging

The client logging mechanism can be triggered by adding 2 logging configuration files into the plasticscm\client directory. This logs the operations performed by the client GUI plastic.exe or the CLI cm.exe.

  • For the GUI client plastic.exe:
    • Add the configuration file plastic.log.conf in the directory where plastic.exe is to activate the logs. You can download a sample of the configuration file for logging here .
    • Please edit the plastic.log.conf file and customize the output file value:
      • If you are on Linux: from <file value="plastic" /> to <file value="${HOME}/.plastic4/plastic.log.txt" />.
      • If you are on Windows: from <file value="plastic" /> to <file value="${LOCALAPPDATA}\plastic4\logs\plastic.log.txt" />.
    • When plastic.exe executes, the log file plastic.log.txt is generated in the specified path.
  • For the CLI client cm.exe:
    • Add the configuration file cm.log.conf in the directory where the cm.exe resides to activate the logs. You can download a sample of the configuration file for logging here .
    • Please edit the cm.log.conf file and customize the output file value:
      • If you are on Linux: from <file value="cm.log.txt" /> to <file value="${HOME}/.plastic4/cm.log.txt" />.
      • If you are on Windows: from <file value="cm.log.txt" /> to <file value="${LOCALAPPDATA}\plastic4\logs\cm.log.txt" />.
    • Operations performed by cm.exe generate a log file cm.log.txt in the specified directory.

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.

Plastic SCM server logging

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.

Common for the client / server logging mechanism

  1. To generate new logs, just delete the previously generated ones (.txt) and new log files will be generated upon execution of either plastic.exe or cm.exe.
  2. For the server logs, if you want to generate a new log file, the server must be stopped, delete loader.log.txt, and restart the Plastic server.
  3. Log levels are defined with logging levels from INFO which dumps lightest level of debug information to DEBUG which dumps more debug information. See an example below:
    <level value="DEBUG" />
  4. The 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.
  5. The DEBUG level can be increased or relaxed on the fly by editing the level value parameters.

Further reading

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.

    <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
        <layout type="log4net.Layout.PatternLayout">
            <conversionPattern value="%message%newline" />

    <appender name="FileAppender" type="log4net.Appender.FileAppender">
        <file value="loader.log.txt" />
        <appendToFile value="true" />
        <layout type="log4net.Layout.PatternLayout">
            <conversionPattern value="%message%newline" />

    <appender name="EventLogAppender" type="log4net.Appender.EventLogAppender" >
        <threshold value="ERROR" />
        <applicationName value="Plastic Server" />
        <layout type="log4net.Layout.PatternLayout">
            <conversionPattern value="%message%newline" />
    <logger name="UpdatePerf">
        <level value="INFO" />
    <logger name="Transaction">
        <level value="INFO" />
    <logger name="Operations">
        <level value="INFO" />
        <level value="ERROR" />
        <appender-ref ref="FileAppender" />
        <appender-ref ref="EventLogAppender" />

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" />