Choose your language

Choose your login

Contact us

Sending Log Data to Another Location

THE PAGE APPLIES TO:

By default the PaperCut Application Server will create all it’s log data in [app dir]/server/logs/server.log. However sometimes you need to have the logs go to a different place, for example a centralised enterprise logging service such as Syslog. PaperCut uses a sophisticated logging facility built around the standard log4j library. This article provides a simple example of how to re-configure PaperCut to log to a Syslog facility.

PaperCut uses the log4j library to generate a vast majority of its log messages. This means that you can re-configure the logger to put the data in a different location or push it to a logging service by using a different log4j appender. A detailed discussion of how to do this correctly is beyond the scope of this article as it will vary depending on the customer requirements and site specifics. Please refer to the Apache log4j documentation at https://logging.apache.org/log4j/2.x/ .

Special Notes

  • After each PaperCut application server upgrade these log4j settings are reset to the original defaults.
  • PaperCut strongly recommends backing up your log configuration file before and after making any changes. These should be archived outside the PaperCut install directory as the files are overwritten during the PaperCut upgrade process
  • PaperCut, particularly in debug mode, can produce a lot of logging of data and you should consider this when configuring the logs
  • The PaperCut print provider logs located on the PaperCut secondary servers cannot be relocated or redirected.
  • PaperCut relies on the ability to clear its logging buffer to operate, this is the primary driver behind logging to the (high speed) local disk of the server. Any change to the logging destination MUST be able to accept this logging data from the server unimpeded. Please note PaperCut support may ask you to return logging to its default location should logging appear to be an issue in troubleshooting.

PaperCut version 21.2.5 and above

Due to upgrading the logging library used by PaperCut to Log4j 2, newer versions of PaperCut MF and NG will need to follow the example settings below when editing the log4j2.properties file. An example for older versions that utilise log4j is listed further down this page.

To configure the PaperCut server log setup, update the following file to create a new logging configuration. [app dir]/server/lib/log4j2.properties

For example, if using a Syslog server:

# Add the syslog appender
rootLogger.appenderRef.syslog.ref = syslog

appender.syslog.type = syslog appender.syslog.name = syslog appender.syslog.facility = LOCAL3 appender.syslog.host = localhost appender.syslog.port = 514 appender.syslog.protocol = UDP

Used to filter the level of log messages

appender.syslog.filter.threshold.type = ThresholdFilter appender.syslog.filter.threshold.level = debug

This is a ConversionPattern equivalent

There are also other ways that the logging output can be formatted, outlined in the log4j2 docs

appender.syslog.layout.type = PatternLayout appender.syslog.layout.pattern = [%-5p] %c - %m%n # Customise to suit

Now restart the PaperCut application server. It is suggested that PaperCut also continues to log to it’s default file for troubleshooting purposes, even if a remote logging service is configured as well. This will make it easier to supply PaperCut support with logs when troubleshooting.

For more information on how to format logging output, a good resource is the official log4j2 documentation: https://logging.apache.org/log4j/2.x/manual/appenders.html#SyslogAppender

Older PaperCut versions

To configure the PaperCut server log setup update the file [app dir]/server/lib/log4j.properties to create a new logging configuration. For example.

1. Add a stanza for a new logging destination:

# Log to a local Syslog server
log4j.appender.SYSLOG=org.apache.log4j.net.SyslogAppender
log4j.appender.SYSLOG.Threshold=INFO

See https://en.wikipedia.org/wiki/Syslog#Facility for a list of allowed values

log4j.appender.SYSLOG.Facility=LOCAL3

log4j.appender.SYSLOG.syslogHost=localhost log4j.appender.SYSLOG.layout=org.apache.log4j.PatternLayout log4j.appender.SYSLOG.layout.ConversionPattern=[%-5p] %c - %m%n # Customise to suit

2. Then update the list of active loggers

# Logs to file and syslog
log4j.rootLogger=error, file, SYSLOG

Now restart the PaperCut application server.

It is suggested that PaperCut also continues to log to its default file for troubleshooting purposes, even if a remote logging service is configured as well. This will make it easier to supply PaperCut support with logs when troubleshooting.


Categories: How-to Articles , Logs


Keywords: logs , logs

Comments

Last updated February 15, 2024