Re: log4j 1.2.14 release
Great! Is an upload to iBiblio.org requested each time a release is done? That would make our life much easier for us Maven developers... Thanks http://jira.codehaus.org/secure/IssueNavigator.jspa?reset=truepid=10367status=1 It is always best if a developer/committer does request the upload... Many thanks Benoit PS: I was about to add an SMTPAppender with authentication in the Kit on http://objectlabkit.sourceforge.net No need now, great. -- View this message in context: http://www.nabble.com/log4j-1.2.14-release-tf2296838.html#a6391640 Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to filter specific characters to not to log
Hi Curt, We are facing problems with this chatacter #0; issue, Is there any standard convention for representing a character of value 0 in XML (and other control characters)? I understand that we can't actually *have* such a character - that's why #0; is illegal - but sometimes we want to output data that includes such characters. or How to escape these characters in xml report. Regards, Praveen On 9/19/06, Curt Arnold [EMAIL PROTECTED] wrote: XMLLayout in both 1.2 and 1.3 can produce bad XML in several scenarios as reported in bugs 29244, 34875 and 37560. Since I was an XML guru in a former life, I know of additional holes in the implementation. If you'd be interested in testing it, I could take a shot at re-implementing XMLLayout. I think that would be a better solution than trying to filter content to avoid the bugs. On Sep 18, 2006, at 1:09 PM, Praveen Kumar Hasthalapuram wrote: Hi, We will get these characters from the devices and these data we will log. These logged data will be used to generate xml reports. With some devices we are getting some control characters (some spl symbols) and these are causing xml report to fail. Is it possible to strip this characters or filter this types of characters. Regards, Praveen - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Add appender programmatically after logger configured initially with PropertyConfigurator
I am trying to add a couple of appenders to my logger in the code based on flags in the application's properties file. I configure the logger with an appender in the logger.properties file initially and I want to add appenders to that programmatically. I add a console appender as well as a file appender (based on the flags). Nothing is being logged to either the console or the file, even though the file is being created. Any help is very much appreciated! Here is the logger.properties file: # Logger for Errors/Debugging (Syslog)log4j.logger.error=DEBUG, A1log4j.appender.A1=org.apache.log4j.net.SyslogAppenderlog4j.appender.A1.syslogHost=localhostlog4j.appender.A1.facility=LOCAL5log4j.appender.A1.layout=org.apache.log4j.PatternLayoutlog4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %m%n # Logger for statslog4j.logger.stats=INFO,A2log4j.appender.A2=org.apache.log4j.RollingFileAppenderlog4j.appender.A2.File=./cust/properties/statslog4j.appender.A2.MaxFileSize=10MBlog4j.appender.A2.MaxBackupIndex=1log4j.appender.A2.layout=org.apache.log4j.PatternLayoutlog4j.appender.A2.layout.ConversionPattern=%d %m%n Here is the application properties file: # Log to consolengl.console=true # Log to local5 (Unix only)ngl.syslog=localhost:local5 # Log to a disk filengl.logfile=./cust/properties/test.txt # Logging level (can be DEBUG, INFO, WARN, ERROR, or CRITICAL|FATAL)ngl.level=DEBUG # Host name that will print out on each log linengl.hostname=localhost # If true, writes abbreviated log header with only level and messagengl.brief=false ngl.config=./cust/properties/logger_config.properties ngl.logger.name=error Here is the actual code to initialize the logger: try { PatternLayout layout;String loggerPropFile = properties.getProperty("ngl.config",null);String loggerName = properties.getProperty("ngl.logger.name", null);if (loggerPropFile != null){PropertyConfigurator.configure(loggerPropFile);} logger = Logger.getLogger(loggerName);Enumeration en = logger.getAllAppenders();int nbrOfAppenders = 0;while (en.hasMoreElements()) {nbrOfAppenders++;Object ap = en.nextElement();}if (nbrOfAppenders 1) { return;}try {if ("true".equals(properties.getProperty("ngl.console", "false"))) {layout = new PatternLayout("%d [%t] %-5p %m%n");logger.addAppender(new ConsoleAppender(layout));}} catch (RuntimeException e) {handleException(e);} try {String logfile = properties.getProperty("ngl.logfile", null); if (logfile != null) {layout = new PatternLayout("%d [%t] %-5p %m%n");logger.addAppender(new FileAppender(layout, logfile));}} catch (RuntimeException e) {handleException(e);}} catch (Exception ex) {handleException(ex);} Donna JohnsonSr. Programmer Analyst FedEx10 Fedex Pkwy2nd Floor HorizontalCollierville, TN 38017 [EMAIL PROTECTED] tel: 901-263-9914 Add me to your address book... Want a signature like this?
RE: Add appender programmatically after logger configured initial ly with PropertyConfigurator
Donna, I think you have to call activateOptions() method on your Appenders. Also what error message / debug trace are you getting? Hope this helps. -Kamal. From: Donna Johnson [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 19, 2006 4:48 PM To: log4j-user@logging.apache.org Subject: Add appender programmatically after logger configured initially with PropertyConfigurator I am trying to add a couple of appenders to my logger in the code based on flags in the application's properties file. I configure the logger with an appender in the logger.properties file initially and I want to add appenders to that programmatically. I add a console appender as well as a file appender (based on the flags). Nothing is being logged to either the console or the file, even though the file is being created. Any help is very much appreciated! Here is the logger.properties file: # Logger for Errors/Debugging (Syslog) log4j.logger.error=DEBUG, A1 log4j.appender.A1=org.apache.log4j.net.SyslogAppender log4j.appender.A1.syslogHost=localhost log4j.appender.A1.facility=LOCAL5 log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %m%n # Logger for stats log4j.logger.stats=INFO,A2 log4j.appender.A2=org.apache.log4j.RollingFileAppender log4j.appender.A2.File=./cust/properties/stats log4j.appender.A2.MaxFileSize=10MB log4j.appender.A2.MaxBackupIndex=1 log4j.appender.A2.layout=org.apache.log4j.PatternLayout log4j.appender.A2.layout.ConversionPattern=%d %m%n Here is the application properties file: # Log to console ngl.console=true # Log to local5 (Unix only) ngl.syslog=localhost:local5 # Log to a disk file ngl.logfile=./cust/properties/test.txt # Logging level (can be DEBUG, INFO, WARN, ERROR, or CRITICAL|FATAL) ngl.level=DEBUG # Host name that will print out on each log line ngl.hostname=localhost # If true, writes abbreviated log header with only level and message ngl.brief=false ngl.config=./cust/properties/logger_config.properties ngl.logger.name=error Here is the actual code to initialize the logger: try { PatternLayout layout; String loggerPropFile = properties.getProperty(ngl.config,null); String loggerName = properties.getProperty(ngl.logger.name, null); if (loggerPropFile != null) { PropertyConfigurator.configure(loggerPropFile); } logger = Logger.getLogger(loggerName); Enumeration en = logger.getAllAppenders(); int nbrOfAppenders = 0; while (en.hasMoreElements()) { nbrOfAppenders++; Object ap = en.nextElement(); } if (nbrOfAppenders 1) { return; } try { if (true.equals(properties .getProperty(ngl.console, false))) { layout = new PatternLayout(%d [%t] %-5p %m%n); logger.addAppender(new ConsoleAppender(layout)); } } catch (RuntimeException e) { handleException(e); } try { String logfile = properties.getProperty(ngl.logfile, null); if (logfile != null) { layout = new PatternLayout(%d [%t] %-5p %m%n); logger.addAppender(new FileAppender(layout, logfile)); } } catch (RuntimeException e) { handleException(e); } } catch (Exception ex) { handleException(ex); } Donna Johnson Sr. Programmer Analyst FedEx 10 Fedex Pkwy 2nd Floor Horizontal Collierville, TN 38017 [EMAIL PROTECTED] tel: 901-263-9914 Add me to your address book... Want a signature like this? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How configure the categories for console, logFile and htmlFile showing different levels
On 9/13/06, David [EMAIL PROTECTED] wrote: I am using categories, but I can't find the appropiate combination for that. I expect the following configuration should work: log4j.rootCategory=DEBUG, logFile, htmlLogFile, console # com.schinvest is my application log4j.additivity.com.schinvest=false log4j.category.com.schinvest = INFO, htmlLogFile, console log4j.category.net.sf =WARN, logFile, htmlLogFile, console log4j.additivity.net.sf =false I get the expected result for console and htmlLogFile, but I don't see the INFO level for my app on logFile I see only the WARN level for external libraries. You have disabled additivity in the com.schinvest category, and the only loggers attached to that category are htmlLogFile and console - the log messages from the com.schinvest logger hierachy aren't reaching the Appender called logFile. -- Javier González Nicolini - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How configure the categories for console, logFile and htmlFile showing different levels
Dear Javier Gonzalez, Thanks for the reply. I have tested not adding the additivity condition, but the I get a repeated messages on one of the outputs. Other guy from the list, tell that what I want is not possible with a properties file configuration, I have to use XML configuration. I have tested its solution and it works, after that I have sent some comment about if there is a way to simplify the configuration. Regards, and thank you, David Javier Gonzalez [EMAIL PROTECTED] wrote: On 9/13/06, David wrote: I am using categories, but I can't find the appropiate combination for that. I expect the following configuration should work: log4j.rootCategory=DEBUG, logFile, htmlLogFile, console # com.schinvest is my application log4j.additivity.com.schinvest=false log4j.category.com.schinvest = INFO, htmlLogFile, console log4j.category.net.sf =WARN, logFile, htmlLogFile, console log4j.additivity.net.sf =false I get the expected result for console and htmlLogFile, but I don't see the INFO level for my app on logFile I see only the WARN level for external libraries. You have disabled additivity in the com.schinvest category, and the only loggers attached to that category are htmlLogFile and console - the log messages from the com.schinvest logger hierachy aren't reaching the Appender called logFile. -- Javier González Nicolini - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? Get on board. You're invited to try the new Yahoo! Mail.