You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-dev@lucene.apache.org by "Henri Biestro (JIRA)" <ji...@apache.org> on 2008/04/23 17:53:21 UTC

[jira] Created: (SOLR-549) Enable configurable logging (jul or log4j)

Enable configurable logging (jul or log4j)
------------------------------------------

                 Key: SOLR-549
                 URL: https://issues.apache.org/jira/browse/SOLR-549
             Project: Solr
          Issue Type: Improvement
    Affects Versions: 1.3
            Reporter: Henri Biestro


java.util.logging does not allow to easily create a self-sufficient 'war' with respect to logging configuration.
The java.util.logging.LogManager used by the application is always created by the container and is thus only configurable through the container; furthermore, if one already uses say log4j in a webapp that embeds Solr, it does not even seem possible to re-route jul logging into log4j just by configuration.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SOLR-549) Enable configurable logging (jul or log4j)

Posted by "Henri Biestro (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-549?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henri Biestro updated SOLR-549:
-------------------------------

    Attachment: solr-log4j.patch

Added target 'dist-log4j' in build.xml to optionally compile the log4j adapter as a jar named 'apache-solr-log4j-1.3-dev'; if the jar in in the classpath, log4j enabled logging is loaded.

The target also copies the produced jar into the tests/lib and adds it to the tests classpath.
Note that log4j.1.2.15.jar must be added in the lib directory.

> Enable configurable logging (jul or log4j)
> ------------------------------------------
>
>                 Key: SOLR-549
>                 URL: https://issues.apache.org/jira/browse/SOLR-549
>             Project: Solr
>          Issue Type: Improvement
>    Affects Versions: 1.3
>            Reporter: Henri Biestro
>         Attachments: solr-log4j.patch, solr-log4j.patch
>
>
> java.util.logging does not allow to easily create a self-sufficient 'war' with respect to logging configuration.
> The java.util.logging.LogManager used by the application is always created by the container and is thus only configurable through the container; furthermore, if one already uses say log4j in a webapp that embeds Solr, it does not even seem possible to re-route jul logging into log4j just by configuration.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (SOLR-549) Enable configurable logging (jul or log4j)

Posted by "Ryan McKinley (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-549?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ryan McKinley resolved SOLR-549.
--------------------------------

       Resolution: Duplicate
    Fix Version/s: 1.4

resolved with  SOLR-560   

> Enable configurable logging (jul or log4j)
> ------------------------------------------
>
>                 Key: SOLR-549
>                 URL: https://issues.apache.org/jira/browse/SOLR-549
>             Project: Solr
>          Issue Type: Improvement
>    Affects Versions: 1.3
>            Reporter: Henri Biestro
>             Fix For: 1.4
>
>         Attachments: solr-log4j.patch, solr-log4j.patch, solr-log4j.patch
>
>
> java.util.logging does not allow to easily create a self-sufficient 'war' with respect to logging configuration.
> The java.util.logging.LogManager used by the application is always created by the container and is thus only configurable through the container; furthermore, if one already uses say log4j in a webapp that embeds Solr, it does not even seem possible to re-route jul logging into log4j just by configuration.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SOLR-549) Enable configurable logging (jul or log4j)

Posted by "Henri Biestro (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-549?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henri Biestro updated SOLR-549:
-------------------------------

    Attachment: solr-log4j.patch

updated for current trunk;
added an 'update' method to Configuration to allow jul logging levels to be reflected into log4j loggers - should allow solr-554 to perform with minor modification

> Enable configurable logging (jul or log4j)
> ------------------------------------------
>
>                 Key: SOLR-549
>                 URL: https://issues.apache.org/jira/browse/SOLR-549
>             Project: Solr
>          Issue Type: Improvement
>    Affects Versions: 1.3
>            Reporter: Henri Biestro
>         Attachments: solr-log4j.patch, solr-log4j.patch, solr-log4j.patch
>
>
> java.util.logging does not allow to easily create a self-sufficient 'war' with respect to logging configuration.
> The java.util.logging.LogManager used by the application is always created by the container and is thus only configurable through the container; furthermore, if one already uses say log4j in a webapp that embeds Solr, it does not even seem possible to re-route jul logging into log4j just by configuration.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-549) Enable configurable logging (jul or log4j)

Posted by "Henri Biestro (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-549?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12591680#action_12591680 ] 

Henri Biestro commented on SOLR-549:
------------------------------------

I agree on all terms; it only solves the "how do I use log4j in solr" and as as such is definitely not as feature-full nor as generic as slf4j.
I also agree that the logging configuration issue is not something that Solr can or should take care of; and I'm not suggesting that we try. I'm just seeking a way to open a door so logging is a choice that can be configured & packaged easily.
The only plus of the patch is that it avoids adding a hard library-dependency (whether on slf4j or log4j) which seemed to be one the blockers in past threads.
If this constraint is relaxed, let's by all means use slf4j and be done!


> Enable configurable logging (jul or log4j)
> ------------------------------------------
>
>                 Key: SOLR-549
>                 URL: https://issues.apache.org/jira/browse/SOLR-549
>             Project: Solr
>          Issue Type: Improvement
>    Affects Versions: 1.3
>            Reporter: Henri Biestro
>         Attachments: solr-log4j.patch
>
>
> java.util.logging does not allow to easily create a self-sufficient 'war' with respect to logging configuration.
> The java.util.logging.LogManager used by the application is always created by the container and is thus only configurable through the container; furthermore, if one already uses say log4j in a webapp that embeds Solr, it does not even seem possible to re-route jul logging into log4j just by configuration.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-549) Enable configurable logging (jul or log4j)

Posted by "Henri Biestro (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-549?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12591998#action_12591998 ] 

Henri Biestro commented on SOLR-549:
------------------------------------

Another way is to abstract away logging by using org.apache.commons as in SOLR-548.

> Enable configurable logging (jul or log4j)
> ------------------------------------------
>
>                 Key: SOLR-549
>                 URL: https://issues.apache.org/jira/browse/SOLR-549
>             Project: Solr
>          Issue Type: Improvement
>    Affects Versions: 1.3
>            Reporter: Henri Biestro
>         Attachments: solr-log4j.patch
>
>
> java.util.logging does not allow to easily create a self-sufficient 'war' with respect to logging configuration.
> The java.util.logging.LogManager used by the application is always created by the container and is thus only configurable through the container; furthermore, if one already uses say log4j in a webapp that embeds Solr, it does not even seem possible to re-route jul logging into log4j just by configuration.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SOLR-549) Enable configurable logging (jul or log4j)

Posted by "Henri Biestro (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-549?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henri Biestro updated SOLR-549:
-------------------------------

    Attachment: solr-log4j.patch

This patch allows to re-route jul logging to log4j if desired; this does not try to change the logging API - ie, the jul logging remains the choice- but gives the web application a chance to initialize logging a bit differently and become log4j firendly.

It introduces a 'org.apache.solr.logging' package from which jul loggers are obtained; instead of writing 'Logger log = java.util.logging.Logger.getLogger("blah");' you write 'Logger log = org.apache.solr.logging.Logger("blah");'. The default behavior is maintained and so are the dependencies.

The implementation classes that depend on log4j (1.2.15) are 'optionally' compiled so far by changing the build.xml 'compile-common' target dependency from 'compile-logging' to 'compile-logging-log4j'. More precisely if the 'org.apache.solr.logging.Configuration' class can be loaded , the framework will return anonymous j.u.l.Loggers having one handler that convert their LogRecords into log4j events, the log4j logger having the name of the intended j.u.l.Logger.
The code comments go through more details.

> Enable configurable logging (jul or log4j)
> ------------------------------------------
>
>                 Key: SOLR-549
>                 URL: https://issues.apache.org/jira/browse/SOLR-549
>             Project: Solr
>          Issue Type: Improvement
>    Affects Versions: 1.3
>            Reporter: Henri Biestro
>         Attachments: solr-log4j.patch
>
>
> java.util.logging does not allow to easily create a self-sufficient 'war' with respect to logging configuration.
> The java.util.logging.LogManager used by the application is always created by the container and is thus only configurable through the container; furthermore, if one already uses say log4j in a webapp that embeds Solr, it does not even seem possible to re-route jul logging into log4j just by configuration.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-549) Enable configurable logging (jul or log4j)

Posted by "Ryan McKinley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-549?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12591672#action_12591672 ] 

Ryan McKinley commented on SOLR-549:
------------------------------------

This solves the "how do I use log4j in solr" problem, but I think it sends solr down the wrong path.  I really don't think we want to deal with configuring the logging internally.  That is what the logging frameworks are supposed to do for us!

Rather then taking this approach, I think we should just use SLF4J (http://www.slf4j.org/), it does what this patch does, but it is supported elsewhere and has more options ;)

> Enable configurable logging (jul or log4j)
> ------------------------------------------
>
>                 Key: SOLR-549
>                 URL: https://issues.apache.org/jira/browse/SOLR-549
>             Project: Solr
>          Issue Type: Improvement
>    Affects Versions: 1.3
>            Reporter: Henri Biestro
>         Attachments: solr-log4j.patch
>
>
> java.util.logging does not allow to easily create a self-sufficient 'war' with respect to logging configuration.
> The java.util.logging.LogManager used by the application is always created by the container and is thus only configurable through the container; furthermore, if one already uses say log4j in a webapp that embeds Solr, it does not even seem possible to re-route jul logging into log4j just by configuration.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.