~~NOTRANS~~
~~Title: Log4j Instead of Logging API~~
If you want to use log4j or log4j2 instead of standard Java logging API for your application, simply add the logger factory configuration to your classpath. First, create a file with the name
**loggerfactory.properties**
in one of your source/resource directories. Don't use a package name!\\
Put following content in it:
default.class=com.sibvisions.util.log.log4j.Log4jLoggerFactory
Don't forget to add the dependencies to your project (log4j or log4j2) and to configure:
log4j.rootLogger=ERROR,stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%p\t%d{ISO8601}\t%r\t%c\t[%t]\t%m%n
or
Another way to configure the logger factory is to set the system property:
LoggerFactory.default=com.sibvisions.util.log.log4j.Log4jLoggerFactory
as JVM start parameter (-DLoggerFactory.default=...).
This system property works in all JVx versions.\\
\\
JVx **before 2.8.5** also had different configuration options:
== config.xml ==
(server zone)
...
com.sibvisions.util.log.log4j.Log4jLoggerFactory
== application.xml ==
...
com.sibvisions.util.log.log4j.Log4jLoggerFactory
\\
These options are not supported in newer JVx versions because you had to configure logging in different places.
\\
**Note**
We have sample files for log4j and log4j2 in our [[http://sourceforge.net/p/jvx/code/HEAD/tree/trunk/java/library/test/|repository]].