NSD1415 Configure OTP Server to log accounting with log4j
Fact
- Nordic Edge One Time Password Server 3
Situation
OTP Server accounting is by default using OTP Server Logging API. This document describes how to use log4j instead which gives possibilities to easily use a wider range of logging destinations.
Solution
1. Before starting configuration the extension file needs to be downloaded ( download here )
2. Unzip the file and copy the AccountLog4j.class file to <otpserver>/ext directory
3. Start the OTP Configurator and enter ext.AccountLog4j as an External Log Handler:
4. Create a file called log4j.properties in the root folder of OTP Server:
This will override the normal log-handling in OTP Server.
5. Add a log4j appender for accounting and one for otplogging (and other appenders as you like).
Note: OTP Accounting logger name is otpaccounting.se.nordicedge
Example of log4j.properties to log "otp accounting" to syslog and "otp logging" to file:
log4j.rootLogger=INFO
## OTP SERVER ACCOUNTING LOG TO SYSLOG
log4j.appender.accounting=org.apache.log4j.net.SyslogAppender
log4j.appender.accounting.syslogHost=127.0.0.1
log4j.appender.accounting.layout=org.apache.log4j.PatternLayout
log4j.appender.accounting.layout.ConversionPattern=%p: – %m%n
log4j.appender.accounting.facility=LOCAL0
log4j.appender.accounting.facilityPrinting=false
log4j.logger.otpaccounting.se.nordicedge = INFO, accounting
## OTP SERVER LOG TO FILE
log4j.appender.access=org.apache.log4j.RollingFileAppender
log4j.appender.access.layout=org.apache.log4j.PatternLayout
log4j.appender.access.MaxFileSize=5000KB
log4j.appender.access.MaxBackupIndex=100
log4j.appender.access.layout.ConversionPattern=%d{ISO8601}: %p: %m%n
log4j.appender.access.File=logs/otpserver.log
log4j.logger.otp.se.nordicedge=INFO, access
6. Restart the OTP Server
For more information on LOG4J please visit: http://projects.apache.org/projects/log4j.html
Disclaimer
The origin of this information may be internal or external to Nordic Edge™. Nordic Edge™ makes all reasonable efforts to verify this information. However, the information provided in this document is for your information only. Nordic Edge™ makes no explicit or implied claims to the validity of this information. Any trademarks referenced in this document are the property of their respective owners.
Nordic Edge Support – www.nordicedge.se
