page under construction

This article makes use of deprecated configuration items and has to be re-worked

Specifying log files

  • YADE can write a separate log file for each transfer it carries out.
  • It can do this when the file transfer is started from the console and when it is started from the crontab. There are two stages to doing this:
    • specifying the global log file name and
    • specifying the log file name for each transfer.

Specifying the global log file name

  • The log file to be used for a particular transfer is defined in the log4j.properties file.
    • A "rollingFileAppender" is used to configure the "global" log, which is not transfer-specific.
  • The log4j.properties file can be located in the same folder as the settings file. The parameter defining the location of log4j does not have to be explicitly set in the profil.

A typical log4j.properties file would look like:

# $Id: log4j.properties 17657 2012-07-23 12:55:04Z kb $

log4j.rootLogger=debug, stdout
log4j.logger.JadeReportLog=info, JadeReportLog, JadeReportLogHTML

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%t %-5p %-14d{hh:mm:ss,SSS} %p (%F:%L) ::%M %m %n

# Configuration for JadeReportLog
log4j.appender.JadeReportLog=org.apache.log4j.RollingFileAppender
log4j.appender.JadeReportLog.File=${java.io.tmpdir}/Jade-client.log
log4j.appender.JadeReportLog.MaxFileSize=5000KB
# Keep a backup copy 
log4j.appender.JadeReportLog.MaxBackupIndex=30
log4j.appender.JadeReportLog.layout=org.apache.log4j.PatternLayout
log4j.appender.JadeReportLog.layout.ConversionPattern=%-21d{hh:mm:ss,SSS}%m %n

Note that

  • the default value for stdout is set by the operating system and
  • the default location for the YADE log file is:
    • /var/opt/sosftp/log/sosdex.log
  • YADE will overwrite the default file name with values set in the log_filename parameter.

Note also that

  • the working directory for chron is not ./jade/bin, where the log4j.properties file is to be found.
  • this means that when starting chron:
    • use cd to navigate to the home directory
    • start jade.sh
    • start runner-script.sh, which switches the working directory to the bin directory
    • the name of the log4j.properties file can then be set with a parameter.

A typical YADE settings file with profiles would look like:

[FTP_123]
protocol = ftps
#port = 49159
host = myHost
user = ftpUser
password = ***********
log4j_Property_FileName = /opt/sosftp/sosdex_client.1.3.12.2032/profile/log4j.properties

[TEST_FTP_REC_new]
include = FTP_123
port = 49157
log_filename = /var/opt/sosftp/log/my_logfile_name.log
#verbose = 9
history = /var/opt/sosftp/log/history_TEST_FTP_REC_new.csv
file_spec = .*\.txt
force_files = false
remove_files = true
transactional = true
atomic_suffix = .tmp
local_dir = /var/data/input/ftpReceive/
remote_dir = ./

Specifying the log file name for each transfer

The log4.jproperties file is universal. The name specified with the log_filename parameter is extended using the extension ".html" and used for log4j. The trick here is that the definitions in the property file are dynamically modified. This results in two files:

  • the file with the name specified in the log_filename parameter and
  • the HTML file with a summary of the transfer. The HTML file will be overwritten with every transfer, the log file specified by the log_filename parameter is a rolling log file.

The complete log4j.properties file would look like this:

# $Id: log4j.properties 17657 2012-07-23 12:55:04Z kb $

log4j.rootLogger=debug, stdout
log4j.logger.JadeReportLog=info, JadeReportLog, JadeReportLogHTML

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%t %-5p %-14d{hh:mm:ss,SSS} %p (%F:%L) ::%M %m %n

# Configuration as HTML
log4j.appender.JadeReportLogHTML=org.apache.log4j.FileAppender
log4j.appender.JadeReportLogHTML.layout=org.apache.log4j.HTMLLayout
log4j.appender.JadeReportLogHTML.File=${java.io.tmpdir}/Jade-client.html
log4j.appender.JadeReportLogHTML.Append=false
log4j.appender.JadeReportLogHTML.layout.Title=YADE - JobScheduler Advanced Data Exchange

# Configuration for JadeReportLog
log4j.appender.JadeReportLog=org.apache.log4j.RollingFileAppender
log4j.appender.JadeReportLog.File=${java.io.tmpdir}/Jade-client.log
log4j.appender.JadeReportLog.MaxFileSize=5000KB
# Keep a backup copy 
log4j.appender.JadeReportLog.MaxBackupIndex=30
log4j.appender.JadeReportLog.layout=org.apache.log4j.PatternLayout
log4j.appender.JadeReportLog.layout.ConversionPattern=%-21d{hh:mm:ss,SSS}%m %n

The transfer-specific log file is configured in the HTML appender shown in the listing above. The file name in the file is just a placeholder. YADE modifies this to "log_filename".html

Note that at the time of writing in the current (1.5.4014) YADE version a standard and relatively simple log4j layout is used. A modified layout, that includes line breaks, is being tested.