Trace: • Log4j Instead of Logging API
Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
jvx:common:util:log4j [2020/01/24 09:27] admin |
jvx:common:util:log4j [2020/06/15 14:40] (current) cduncan Edited for English grammar (capitalization, punctuation, correct verb conjugation) |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ~~NOTRANS~~ | ~~NOTRANS~~ | ||
| - | ~~Title: Log4j instead of Logging API~~ | + | ~~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 | 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 | ||
| Line 22: | Line 22: | ||
| log4j.appender.stdout.layout.ConversionPattern=%p\t%d{ISO8601}\t%r\t%c\t[%t]\t%m%n | log4j.appender.stdout.layout.ConversionPattern=%p\t%d{ISO8601}\t%r\t%c\t[%t]\t%m%n | ||
| </file> | </file> | ||
| + | |||
| + | or | ||
| <file xml log4j2.xml> | <file xml log4j2.xml> | ||
| Line 43: | Line 45: | ||
| </file> | </file> | ||
| - | Another option, to configure the logger factory is to set the system property: | + | Another way to configure the logger factory is to set the system property: |
| <code> | <code> | ||
| Line 50: | Line 52: | ||
| as JVM start parameter (-DLoggerFactory.default=...). | as JVM start parameter (-DLoggerFactory.default=...). | ||
| - | This system property works in all JVx versions. JVx before 2.8.5 also had different configuration options: | + | This system property works in all JVx versions.\\ |
| + | \\ | ||
| + | JVx **before 2.8.5** also had different configuration options: | ||
| - | * config.xml of your server zone: | + | == config.xml == |
| + | |||
| + | (server zone) | ||
| <file xml config.xml> | <file xml config.xml> | ||
| Line 58: | Line 64: | ||
| <server> | <server> | ||
| + | ... | ||
| | | ||
| <logfactory>com.sibvisions.util.log.log4j.Log4jLoggerFactory</logfactory> | <logfactory>com.sibvisions.util.log.log4j.Log4jLoggerFactory</logfactory> | ||
| - | |||
| - | ... | ||
| </server> | </server> | ||
| </file> | </file> | ||
| - | * application.xml | + | == application.xml == |
| - | <file script> | + | <file xml application.xml> |
| <application> | <application> | ||
| ... | ... | ||
| + | | ||
| <Launcher.logfactory>com.sibvisions.util.log.log4j.Log4jLoggerFactory</Launcher.logfactory> | <Launcher.logfactory>com.sibvisions.util.log.log4j.Log4jLoggerFactory</Launcher.logfactory> | ||
| </application> | </application> | ||
| </file> | </file> | ||
| - | This options are not supported in newer JVx versions because you had to configure logging in different places. | + | \\ |
| + | These options are not supported in newer JVx versions because you had to configure logging in different places. | ||
| \\ | \\ | ||
