[slf4j-user] How to configure logger for jackrabbit-standalone-2.6.0.jar

ceki ceki at qos.ch
Tue Apr 9 11:01:06 CEST 2013


Hi Ulrich,

Comments inline.

On 09.04.2013 09:46, Ulrich wrote:
> I'm trying to setup logging with a program using the
> jackrabbit-standalone-2.6.0.jar. This archive contains some slf4j-packages
> (org.slf4j, org.slf4j.helpers, org.slf4j.impl, org.slf4j.spi)  but as far as I
> can see no logging framework. But when I add the slf4j-log4j12-1.7.2.jar I get
> the 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 an opportunity to see which kind of implementer is used here?

As of version 1.6.6, in case multiple bindings are found on the class 
path, SLF4J will output the name of the framework/implementation class 
it binds with. Just after the "SLF4J: Found binding" lines, there should 
be a line starting with:

   "SLF4J: Actual binding is of type []"

Have you missed that line?

The contents of jackrabbit-standalone-2.6.0.jar indicate that its ships 
with logback as the logging framework. The 
jackrabbit-standalone-2.6.0.jar file also ships with a logback.xml 
configuration file.

Here is that 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 any string within ${} designates a 
variable. See [1] for exact details.

Looking at the logback.xml file above, we can see that the variables 
${jackrabbit.log}, ${jetty.log} and "${log.level} are referenced. These 
variables are set by the prepareServerLog() method in Main class of 
jackrabbit-standalone [2]. The prepareServerLog() is invoked unless the 
"-i" or "--cli" option is given on the command line. Are you invoking 
jackrabbit with -i or --cli?

Anyway, it would be helpful to post here all messages printed by SLF4J 
as well the command you are using to launch jackrabbit-standalone.


[1] http://logback.qos.ch/manual/configuration.html#variableSubstitution
[2] http://goo.gl/Lf3Ig
-- 
Ceki
65% of statistics are made up on the spot


More information about the slf4j-user mailing list