jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ceki Gulcu (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (JCR-3564) Possible improvement: use logback's "default value for variables" functionality
Date Tue, 09 Apr 2013 11:32:15 GMT

    [ https://issues.apache.org/jira/browse/JCR-3564?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13626498#comment-13626498

Ceki Gulcu commented on JCR-3564:

Mystery soved: the user interacts with Jackrabbit in a batch file. This batch file adds jackrabbit-standalone-2.0.6.jar
on the class path. It apparently does not invoke Main [2]. To cater for such use cases, logback's
"default value for variables" mechanism makes sense.

[2]  http://goo.gl/Lf3Ig 
> Possible improvement: use logback's "default value for variables" functionality
> -------------------------------------------------------------------------------
>                 Key: JCR-3564
>                 URL: https://issues.apache.org/jira/browse/JCR-3564
>             Project: Jackrabbit Content Repository
>          Issue Type: Improvement
>          Components: jackrabbit-standalone
>    Affects Versions: 2.6
>            Reporter: Ceki Gulcu
> In a recent message [1], a jackrabbit-standalone user complained about not being able
to configure logging.  The user was complaining about the logs being output into the file
"jackrabbit.log_IS_UNDEFINED" . The UNDEFINED suffix is used by logback to indicate that the
variable ${jackrabbit.log} was well, undefined. The logback.xml file shipping in jackrabbit-standalone-2.6.0.jar
indeed makes use of this variable to define the output target of a FileAppender.
> After some investigation, in appears that prepareServerLog() method in Main [2] class
sets this variable/system property (among other logging related system properties). Thus,
I don't really understand how the ${jackrabbit.log} variable can be undefined as it should
be defined by prepareServerLog() method. 
> Having said that, I think it would be possible to get rid of the prepareServerLog() method
altogether by using logback's  "default value for variables" functionality [3].  The variable
substitution capabilities of logback are inanely powerful. Variable names as well as default
values can be nested, even multiple times.
> For example, the file property of the FileAppender named jackrabbit could be written
> <file>${jackrabbit.log:-${repo:-jackrabbit}/log/jackrabbit.log}</file>
> If the $repo and ${jackrabbit.log} variables are not defined, the file property will
be set to "jackrabbit/log/jackrabbit.log". Logback will automatically create missing folders
if any. if you wish to use the fully qualified path for ${repo}, then you can set it as a
system property and let logback perform the rest of the substitution.
> Similarly, the root level could be set to INFO by default, but still allow it to be overridden
by setting ${log.level}: 
>  <root level="${log.level:-INFO}">
> I hope you find the above helpful,
> [1] http://markmail.org/message/mriltleg4an6yu4e
> [2] http://goo.gl/Lf3Ig
> [3] http://logback.qos.ch/manual/configuration.html#defaultValuesForVariables

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

View raw message