You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

FTP Server Logging

FTP Server uses Commons Logging throughout its internal code allowing the developer to choose a logging configuration that suits their needs, e.g java.util.logging or Log4J. Commons Logging provides FTP Server the ability to log hierarchially across various log levels without needing to rely on a particular logging implementation.

log4j

If you need to setup detailed logging from within FTP Server's code, then you can use a simple log4j configuration. Note that this logging can be very verbose depending on the log level you chose to use. The log4j jar is bundled with the binary distribution. This is an optional jar file. If you remove this jar file, other logging implementation will be autometically selected by the commons-logging.

The log4j configuration file location is <INSTALL_DIR>/common/classes/log4j.properties. You can modify this file to configure log4j.

log4j.rootLogger=DEBUG, R
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=./res/log/log.gen
log4j.appender.R.MaxFileSize=10MB
log4j.appender.R.MaxBackupIndex=10
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=[%5p] %d %m%n

This log4j configuration sets up a file called log.gen in your FTP Server ./res/log folder with a maximum file size of 10MB and up to 10 backups. DEBUG log level is specified.

You should consult the log4j documentation for more options.

java.util.logging

In order to configure JDK logging you should have JDK 1.4+. In the JDK's logging.properties file. Check your JAVA_HOME environment setting to see which JDK FTP Server is using. The file will be in $JAVA_HOME/jre/lib. Alternately, it can also use a global configuration file located elsewhere by using the system property java.util.logging.config.file, or programmatic configuration using java.util.logging.config.class.

The default logging.properties specifies a ConsoleHandler for routing logging to stdout and also a FileHandler. A handler's log level threshold can be set using SEVERE, CONFIG, INFO, WARN, FINE, FINEST or ALL. The logging.properties shipped with JDK is set to INFO. Please refer to Sun's java.util.logging documentation for the complete details.

  • No labels