log4j - How to configure logger for jackrabbit-standalone-2.6.0.jar -
i'm trying setup logging program using jackrabbit-standalone-2.6.0.jar. archive contains slf4j-packages (org.slf4j, org.slf4j.helpers, org.slf4j.impl, org.slf4j.spi) far can see no logging framework. when add slf4j-log4j12-1.7.2.jar messages:
slf4j: found binding in [jar:file:/d:/anwendungen/eclipseplugins/jackrabbit/jackrabbit-standalone-2.6.0.jar!/org/slf4j/impl/staticloggerbinder.class] slf4j: found binding in [jar:file:/d:/anwendungen/eclipseplugins/slf4j-1.7.2/slf4j-1.7.2/slf4j-log4j12-1.7.2.jar!/org/slf4j/impl/staticloggerbinder.class]
is there opportunity see kind of implementer used here?
i want configure logger. right writes big amount of debug messages file called "jackrabit.log_is_undefined" , urgently need suppress this. there several hints found in internet suggesting setup logger don't understand need do. classes "domconfigurator" , "propertyconfigurator" not available within package, when adding example "slf4j-log4j12-1.7.2.jar" above described messages. can't initialize logger within program. said add configuration-xml classpath. tried (in eclipse added folder conatining xml buildpath, created jar-file xml-file , added jar-file buildpath) didn't make difference.
i read description "default initialization procedure" in http://logging.apache.org/log4j/1.2/manual.html have state didn't understand @ all. mean: 2. set resource string variable value of log4j.configuration system property. preferred way specify default initialization file through log4j.configuration system property. in case system property log4j.configuration not defined, set string variable resource default value "log4j.properties". have specify resource-string variable?
my log4j.xml-file:
<?xml version="1.0" encoding="utf-8"?> <!doctype log4j:configuration system "log4j.dtd"> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> <appender name="console" class="org.apache.log4j.consoleappender"> <layout class="org.apache.log4j.patternlayout"> <param name="conversionpattern" value="%d %-5p [%c{1}] %m %n" /> </layout> </appender> <root> <priority value="info" /> <appender-ref ref="console" /> </root> </log4j:configuration>
any idea configure logger either programmatically or default initialization welcome.
ulrich
as of version 1.6.6, in case multiple bindings found on class path, slf4j output name of framework/implementation class binds with. after "slf4j: found binding
" lines, there should line starting with:
"slf4j: actual binding of type []"
have missed line?
the contents of jackrabbit-standalone-2.6.0.jar indicate ships logback logging framework. jackrabbit-standalone-2.6.0.jar file ships logback.xml configuration file.
here logback.xml file:
<configuration> <appender name="jackrabbit" class="ch.qos.logback.core.fileappender"> <file>${jackrabbit.log}</file> <encoder> <pattern>%d{yyyy-mm-dd hh:mm:ss.sss} %-5level %-40([%thread] %f:%l) %msg%n</pattern> </encoder> </appender> <appender name="jetty" class="ch.qos.logback.core.fileappender"> <file>${jetty.log}</file> <encoder> <pattern>%d{yyyy-mm-dd hh:mm:ss.sss} %-5level %-40([%thread] %f:%l) %msg%n</pattern> </encoder> </appender> <logger name="org.mortbay.log" level="${log.level}" additivity="false"> <appender-ref ref="jetty"/> </logger> <root level="${log.level}"> <appender-ref ref="jackrabbit"/> </root> </configuration>
as in unix shells, in logback.xml string within ${} designates variable.
looking @ logback.xml file above, can see variables ${jackrabbit.log}, ${jetty.log} , "${log.level} referenced. these variables set prepareserverlog() method in main class of jackrabbit-standalone 2. prepareserverlog() invoked unless "-i" or "--cli" option given on command line. invoking jackrabbit -i or --cli?
anyway, helpful post here messages printed slf4j command using launch jackrabbit-standalone.
Comments
Post a Comment