You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bu...@apache.org on 2006/06/26 08:04:25 UTC

DO NOT REPLY [Bug 39901] New: - Log4j Configurator Task

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39901>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=39901

           Summary: Log4j Configurator Task
           Product: Ant
           Version: unspecified
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Optional Tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: bugzilla-apache@mofokom.biz


In some build systems log4j never gets configured.  I have created a Log4J ant
task which configurates the and set the levels.  It is so simple.


package util;

public class Log4jAntTask extends org.apache.tools.ant.Task {
        String level;

        public Log4jAntTask(){
                org.apache.log4j.BasicConfigurator.configure();
               
org.apache.log4j.Logger.getRootLogger().setLevel(org.apache.log4j.Level.toLevel(level));
                   
                org.apache.log4j.Logger.getRootLogger().setAdditivity(true);   
                

        }
        public void setLevel(String level){
                this.level=level;
        }    
}

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


DO NOT REPLY [Bug 39901] - Log4j Configurator Task

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39901>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=39901


gudnabrsam@yahoo.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO




------- Additional Comments From gudnabrsam@yahoo.com  2006-06-27 18:31 -------
There are very few cases where we are going to add anything to Ant with
compilation dependencies... can you explain more under what circumstances you
had intended this would be applicable?

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


DO NOT REPLY [Bug 39901] - Log4j Configurator Task

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39901>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=39901





------- Additional Comments From jan@materne.de  2006-07-07 14:55 -------
See also the updated manual according to the Log4J-Listener
http://svn.apache.org/repos/asf/ant/core/trunk/docs/manual/listeners.html#Log4jListener

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


DO NOT REPLY [Bug 39901] - Log4j Configurator Task

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39901>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=39901





------- Additional Comments From stevel@apache.org  2006-06-28 10:47 -------
XDoclet is a use case that springs to mind. 

You dont really need a task for this though. just add a jar to ANT_HOME/lib
containing a log4j.properties file

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


DO NOT REPLY [Bug 39901] - Log4j Configurator Task

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39901>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=39901





------- Additional Comments From stevel@apache.org  2006-07-07 16:20 -------
Jan, this is different, this is setting up log4j so that you dont get told off
for not having log4j configured. 

the underlying problem is that log4j tells you off for not having log4j
configured, when in reality the unconfigured state is probably the most popular
configuration of the tool. I hear rumors it be fixed eventually.

this task assumes, however, that log4j is on ant's classpath. if you load
xdoclet with log4j only cropping up there, this task fails horribly.

Also, note how the task will always set to level=0 because the config happens in
the constructor, before the setter is called. something like this should be done
in the executor method, and it should use reflection and fail properly if log4j
is not found. 

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org