|
[
Permlink
| « Hide
]
Alex Loddengaard added a comment - 03/Dec/08 01:10 AM
Attaching a patch that removes conf/log4j.properties and adds conf/log4j.xml, which is configuration-equivalent to the original log4j.properties file. I have used this XML file on a single-node cluster; the integration seems to be seamless.
Alex Loddengaard made changes - 03/Dec/08 01:10 AM
Alex Loddengaard made changes - 03/Dec/08 01:10 AM
If both a .properties and a .xml file exist, which has precedence? If the .properties file has precedence, then this is a back-compatible change. Folks that are using a modified log4j.properties file would continue to use their modified version. But if the .xml file has precedence then this would not be back-compatible, right?
Also, should we make this a .template file? (Anything in conf/ ending in .template is copied to its name minus the .template by the build and the .template version is not included in releases. This is because we expect folks to edit these files and do not want to commit their changes to subversion or include them in patches, so only the .template version exists in subversion.) Unfortunately the XML file takes precedence over the .properties file, making this patch not backwards compatible. However, I am attaching a new patch that adds a log4j.xml.template file instead of a log4j.xml file.
Given that this patch is not backwards compatible, its inclusion may not ever happen. However, at least this issue can be referenced when users need to use the XML file instead of the .properties file. Thanks for the comments, Doug!
Alex Loddengaard made changes - 03/Dec/08 07:22 PM
> Given that this patch is not backwards compatible, its inclusion may not ever happen.
Given the recent proposal of Hadoop 1.0 and issues like I would personally argue against having any log4j config file in a JAR, as trying to track down the origin of broken logging settings in a big application is painful. Indeed, it is the origin of the <whichresource> task in Ant
<whichresource resource="/log4j.properties" property="log4j.url" > A key issue here is that when hadoop-core is used as a client library, that client may pick up the hadoop log policy not its own. Even in a cluster, Logging settings are very installation specific; embedding them in a JAR means you need to edit the JAR to replace them. If all Log4J settings were omitted and yet could be picked up from a conf directory, all would be well. Maybe the solution here is to permit site-conf jars that contain only the configuration files; you could switch to a different configuration JAR without rebuilding/redistributing hadoop-core itself. You bring up a great point, Steve. My main concern is that I don't think we want to make installing and configuring Hadoop any harder than it is now. Your solution of having a conf JAR wouldn't make installing and configuring any more difficult, and it would also allow "advanced" users to modify, include, or not include this JAR.
-1 overall. Here are the results of testing the latest attachment
http://issues.apache.org/jira/secure/attachment/12395204/log4j_xml_config_v2.patch against trunk revision 724229. +1 @author. The patch does not contain any @author tags. -1 tests included. The patch doesn't appear to include any new or modified tests. +1 javadoc. The javadoc tool did not generate any warning messages. +1 javac. The applied patch does not increase the total number of javac compiler warnings. +1 findbugs. The patch does not introduce any new Findbugs warnings. +1 Eclipse classpath. The patch retains Eclipse classpath integrity. -1 core tests. The patch failed core unit tests. +1 contrib tests. The patch passed contrib unit tests. Test results: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch/3685/testReport/ This message is automatically generated. Alex-
I've looked at the patch and have a few questions.
Jakob Homan made changes - 09/Dec/08 12:15 AM
These are great questions, Jakob. Let me answer what I can now. The more difficult questions will require some research on my part:
Yes, this was a typo on my behalf. Good catch!
These appenders are commented out in the .properties file, which made me think they were deprecated. If people are using them, then I totally agree that they should be included in the XML file. Another good catch.
From the testing I did, no. As long as the log4j.properties file is not in the CLASSPATH (removed from $HADOOP_HOME/conf) and the log4j.xml file is, then log4j.xml will be used. Again, I'll do some research and fiddling and respond to your other questions. Thanks, Jakob! The commented out ones aren't deprecated, they are just other possibilities.
After some digging, and with some help from Aaron Kimball, I've realized that Hadoop's current implementation depends on a few global log4j variables to be set in order for Java code to dynamically overwrite the variable values. Namely, org.apache.hadoop.mapred.TaskRunner sets the "hadoop.tasklog.taskid" variable, which allows org.apache.hadoop.mapred.TaskLogAppender to output logs with the task ID in the log filename.
According to the DTD, Log4j XML files do not allow for top-level "param" elements, making it seem as though global variables are impossible in the XML file. With that said, Hadoop's current task log implementation is incompatible with Log4j XML files. Though having XML files would be nice for purposes of unlocking Log4j features (AsyncAppenders, for example), I don't have enough Log4j fu to propose a new implementation of the current TaskLogAppender/TaskRunner/Log4j setup. Thoughts? |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||