[ http://issues.apache.org/jira/browse/AXIS2-734?page=comments#action_12416294 ]
Davanum Srinivas commented on AXIS2-734: ---------------------------------------- Please remove log4j.jar and you will not see #1 > Log4j settings and configuration > -------------------------------- > > Key: AXIS2-734 > URL: http://issues.apache.org/jira/browse/AXIS2-734 > Project: Apache Axis 2.0 (Axis2) > Type: Bug > Reporter: Davanum Srinivas > Assignee: Eran Chinthaka > > Original email: > http://mail-archives.apache.org/mod_mbox/ws-axis-dev/200605.mbox/[EMAIL > PROTECTED] > 1. Annoyance: WSDL2Java.bat issues a warning because Log4J cannot be > properly configured. > When running WSDL2Java.bat, the following warning is displayed: > log4j:WARN No appenders could be found for logger > (org.apache.axis2.i18n.ProjectResourceBundle). > log4j:WARN Please initialize the log4j system properly. > To fix this, add the following line: > set > AXIS2_CLASS_PATH=%AXIS2_CLASS_PATH%;%AXIS2_HOME%\modules\core\conf > into the WSDL2Java.bat file, after these lines: > rem loop through the libs and add them to the class path > set AXIS2_CLASS_PATH=%AXIS2_HOME% > FOR %%c in ("%AXIS2_HOME%\lib\*.jar") DO set > AXIS2_CLASS_PATH=!AXIS2_CLASS_PATH!;%%c > %AXIS2_HOME%\modules\core\conf is the location of the Axis2-distributed > log4j.properties file. > 14. Annoyance: The log4j.properties file shipped with Axis2 circumvents > the ability for the developers to change the logging level of their > classes. > I have included a modified log4j.properties file that actually allows me > to put my classes into DEBUG level while leaving Axis2 and Tomcat logging > at their levels. > 15. Annoyance: Axis2 only allows for Log4J.properties to configure > logging, not Log4J.xml > Log4J can be configured using either a properties or an xml file. There > is a growing number of Logging capabilities that are only configurable > using the XML file. The code that sets up configuration of Log4J in Axis2 > should allow for both types of configuration files. > 16. Annoyance: Axis2 does not use ConfigureAndWatch capabilities of > Log4J > Log4J can be configured using a ConfigureAndWatch method that causes Log4J > to monitor its configuration file and automatically apply changes made to > that file to its configuration. This means that if support personnel need > to modify the logging configuration of a production application, only the > log4j configuration file needs to be modified and the Application server > does not need to be restarted. > Following is a snippet of code for a Log4jUtils class that addresses > Annoyances 15 and 16. > The configureAndWatch method of this utility class should be called by an > initialization servelet or some other configuration and initialization > class. > ------ > import org.apache.log4j.BasicConfigurator; > import org.apache.log4j.PropertyConfigurator; > import org.apache.log4j.helpers.FileWatchdog; > import org.apache.log4j.net.SyslogAppender; > import org.apache.log4j.xml.DOMConfigurator; > . > . > . > /** > * A collection of static utility methods for logging with Log4J. > */ > public final class Log4jUtils { > private static final Logger LOG = > Logger.getInstance(Log4jUtils.class); > private static loggingConfigured = false; > private Log4jUtils() { > // All methods are static, this class should not be instantiated > } > . > . > . > /** > * Implements configureAndWatch for the current ClassLoader hierarchy > using the Log4J > * default number of seconds. > */ > public static void configureAndWatch() { > configureAndWatch(FileWatchdog.DEFAULT_DELAY); > } > > /** > * Implements configureAndWatch for the current ClassLoader hierarchy. > * > * @param watchMillisecs The number of milliseconds to wait between > checking to see if the > * log4j configuration file has changed. > */ > public static void configureAndWatch(long watchMillisecs) { > if (loggingConfigured) return; > Class myClass = Log4jUtils.class; > ClassLoader classLoader = myClass.getClassLoader(); > // Initialize LOG4J > URL resourceUrl = classLoader.getResource("log4j.xml"); > if (resourceUrl != null) { > String configFile = resourceUrl.getFile(); > DOMConfigurator.configureAndWatch(configFile, watchMillisecs); > } else { > resourceUrl = classLoader.getResource("log4j.properties"); > if (resourceUrl != null) { > String configFile = resourceUrl.getFile(); > PropertyConfigurator.configureAndWatch(configFile, > watchMillisecs); > } else { > // Since we aren't going to be able to pull our "real" > settings, > // let's at least make sure we get some output > BasicConfigurator.configure(); > // Log an error with detail regarding the problem (and > suspected cause) > LOG.error(myClass.getName(), "Unable to find log4j.xml or > log4j.properties. " + > "Make sure the log4j > configuration file is in the Classpath."); > } > } > loggingConfigured = true; > } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
