Re: JDK logging appender that sends events to log4j
Looking at http://people.apache.org/~psmith/logging.apache.org/sandbox/jul-log4j-bridge/examples.html I tried adding: plugin name=julreceiver class=org.apache.log4j.jul.JULReceiver / but I get: log4j: Using URL [file:/C:/Tomcat/lib/log4j.xml] for automatic log4j configuration. log4j: Preferred configurator class: org.apache.log4j.xml.DOMConfigurator log4j: System property is :null log4j: Standard DocumentBuilderFactory search succeded. log4j: DocumentBuilderFactory is: org.apache.xerces.jaxp.DocumentBuilderFactoryImpl log4j:WARN Continuable parsing error 132 and column 23 log4j:WARN The content of element type log4j:configuration must match (renderer*,appender*,plugin*,(category|logger)*,root?,(categoryFactory|loggerFactory)?). log4j: debug attribute= true. log4j: reset attribute= false. log4j: Threshold =null. log4j:WARN Unrecognized element plugin I am using log4j 1.2.15 and apache-jul-log4j-bridge-1.0.0-20080915.045446-7.jar James A. N. Stauffer http://jamesjive.blogspot.com Are you good? Take the test at http://www.livingwaters.com/good/ On Tue, Jun 19, 2007 at 5:08 PM, Paul Smith psm...@aconex.com wrote: The SVN checkout url is here: http://svn.apache.org/repos/asf/logging/sandbox/jul-to-log4j-bridge/ It does rely on the latest 1.2.15 snapshot. The dependency snapshot identifiers have recently changed, so I've just updated them. Please try the latest trunk version (revision 548865). There is one unit test that does appear to fail under mvn, but not under eclipse, so building it requires: mvn package -Dmaven.test.skip=true Let me know if it helps you. cheers, Paul On 20/06/2007, at 7:40 AM, Scott Deboy wrote: Sorry..try this one: http://svn.apache.org/viewvc/logging/sandbox/jul-to-log4j-bridge/ Scott Deboy Principal Engineer COMOTIV SYSTEMS 111 SW Columbia Street Ste. 950 Portland, OR 97201 Office: 503.224.7496 Direct Line: 503.821.6482 Cell: 503.997.1367 Fax: 503.222.0185 sde...@comotivsystems.com www.comotivsystems.com -Original Message- From: James Stauffer [mailto:stauffer.ja...@gmail.com] Sent: Tuesday, June 19, 2007 2:22 PM To: Log4J Users List Subject: Re: JDK logging appender that sends events to log4j That appears to be the reverse of my idea. On 6/19/07, Scott Deboy sde...@comotivsystems.com wrote: A recent contribution: http://issues.apache.org/bugzilla/show_bug.cgi?id=42664 Looks like a great idea to me. Scott Deboy Principal Engineer COMOTIV SYSTEMS 111 SW Columbia Street Ste. 950 Portland, OR 97201 Office: 503.224.7496 Direct Line: 503.821.6482 Cell: 503.997.1367 Fax: 503.222.0185 sde...@comotivsystems.com www.comotivsystems.com -Original Message- From: James Stauffer [mailto:stauffer.ja...@gmail.com] Sent: Tuesday, June 19, 2007 2:07 PM To: Log4J Users List Subject: JDK logging appender that sends events to log4j Has anyone made a JDK logging appender that sends events to log4j? This would achieve much the same benefit of commons-logging without any extra downloads when log4j isn't used. I.e. I would like to use JDK logging on the client and log4j on the server. -- James Stauffer http://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org -- James Stauffer http://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org Paul Smith Core Engineering Manager Aconex The easy way to save time and money on your project 696 Bourke Street, Melbourne, VIC 3000, Australia Tel: +61 3 9240 0200 Fax: +61 3 9240 0299 Email: psm...@aconex.com www.aconex.com This email and any attachments are intended solely for the addressee. The contents may be privileged, confidential and/or subject to copyright or other applicable law. No confidentiality or privilege is lost by an erroneous transmission. If you have received this e-mail in error, please let us know by reply e-mail and delete or destroy this mail and all copies. If you are not the intended recipient of this message you must not disseminate, copy or take any action in reliance
logger.warn(Throwable)
If a Throwable (with no second parameter) is passed as a message object, could log4j assume that it was in error and use the parameter as both the 1st and 2nd parameter? I have seen many instances of people using logger.warn(t) James A. N. Stauffer http://jamesjive.blogspot.com Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
Re: log4j issue
ConsAppender sends the logs to standad output. James A. N. Stauffer http://jamesjive.blogspot.com Are you good? Take the test at http://www.livingwaters.com/good/ On Wed, Jul 27, 2011 at 4:28 PM, Sivaks sivakumar.subbura...@verizonwireless.com wrote: Hi, One of our old project has got lot of System.out.println statements. We converted that to log4j logging. Now we are seeing all logging statements are going to the file which i mentioned in log4j. The problem is that, still it is getting logged in SystemOut.log file too. I am also attaching log4j.xml for reference. Any help appreciated http://old.nabble.com/file/p32151973/log4j.xml log4j.xml Regards, Siva -- View this message in context: http://old.nabble.com/log4j-issue-tp32151973p32151973.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
Re: Get the following error: NoClassDefFoundError: org.apache.log4j.Logger
You need to add log4j.jar to your classpath. James A. N. Stauffer http://jamesjive.blogspot.com Are you good? Take the test at http://www.livingwaters.com/good/ On Wed, Feb 2, 2011 at 4:21 AM, henry human henry_hu...@yahoo.de wrote: Hi I get the following error when I try to call a smal java application(hello friends!) which i placed in a jar file. the application has the log4j.jar in its lib directory (and classpath) and calls the log4j.logger like this: private static final Logger LOGGER = Logger.getLogger(Hello.class); It works when i run the application in eclipse but not when I pack it as a JAR application! (he application is not running on tomcat an is only a smal commandline application) Error: Exception in thread main java.lang.NoClassDefFoundError: org/apache/log4j/Logger Thanks for your advice - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
Measuring logging performance impact (including string concatenation)
Our applications have extensive use of logging (most commons-logging over log4j, and j.u.l). We use j.u.l for code that runs in an applet so we don't incur the cost of an extra jar download. Since we don't have access to message formats, we incur the cost the log message string concatenation even when the level is turned off. We could wrap every log call in a level check but that makes the code more messy. Is there a good way to measure the performance impact (i.e. % of CPU time) used for logging statements (include the string concatenation for the log message)? -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
Re: Measuring logging performance impact (including string concatenation)
Thanks Ceki! Two of our projects use NDC so I'll probably leave them with log4j but I might switch the j.u.l calls to SLF4J. I see that j.u.l does support parameterized messages but they don't use varargs so you have to explicitly create an extra Object[] and it requires you to pass the level. On Tue, Feb 23, 2010 at 11:16 AM, Ceki Gülcü c...@qos.ch wrote: Hello James, There is no perfect way to measure the overhead of parameter constructions, but 200 nanosecond is a reasonable lower bound. So, if you call a disabled logger 1'000'000 times you will see an overhead of at least 200 milliseconds. Nothing to call home about. However, the toString() methods of certain objects can be very costly so the impact of parameter construction can be much higher than 200 nanos. BTW, SLF4J handles this use case very nicely. Note that slf4-api.jar is 23K in size and slf4j-jdk14.jar (which logs to java.util.logging) is only 8K. If you were using the SLF4J API, you could instruct SLF4J to delegate to java.util.logging via slf4j-jdk14.jar, solving the overhead problem at the cost of additional 31K to download during applet start up. Moreover, if you were using SLF4J throughout your application, the rest of your application could share code with the applet as both the application and the applet would be using the same logging API. Your application of course could continue to delegate logging to log4j as you do currently. HTH, -- Ceki http://logback.qos.ch: The reliable, generic, fast and flexible logging framework. On 23/02/2010 5:53 PM, James A. N. Stauffer wrote: Our applications have extensive use of logging (most commons-logging over log4j, and j.u.l). We use j.u.l for code that runs in an applet so we don't incur the cost of an extra jar download. Since we don't have access to message formats, we incur the cost the log message string concatenation even when the level is turned off. We could wrap every log call in a level check but that makes the code more messy. Is there a good way to measure the performance impact (i.e. % of CPU time) used for logging statements (include the string concatenation for the log message)? - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
Re: I need to make logging in a complete application
Search and replace: System.out.println( - logger.debug( Then add a logger definition to each base class. James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ On Fri, Dec 26, 2008 at 8:28 AM, Ariel isaacr...@gmail.com wrote: Hi everybody: I am newbie with log4j, I have made a distributed and multithreaded application where all the logging is made displaying de mesagges in the console using System.out.println. Now I want to redirect those messages to a file to have a trace of all the messages. Is there anyway to telling log4j that all the System.out messages write them into a file ??? Please could you help me ? Regards Ariel - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
Re: How to use a RollingFileAppender asynchronously?
Multiple processes can't write to the same file even with AsyncAppender. AsyncAppender is so that logging doesn't have to wait for the message to be written when the underlying appender could take a while to write. James A. N. Stauffer http://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ On Wed, Jun 18, 2008 at 2:01 PM, krista [EMAIL PROTECTED] wrote: I was wondering if anyone knew if there was a built in way to use a RollingFileAppender combined with the AsyncAppender? I have a log file that needs rollover capability and that multiple processes will be hitting. This seems like a pretty common thing to need, but I can't find any references to it anywhere. I've seen that the AsynchAppender has an addAppender method, but how exactly does that work, and what if I want to configure it all in my property file? Do I need to load the property file containing the AsynchAppender and then attach the RollingFileAppender programmatically? Thank you in advance for any responses. -- View this message in context: http://www.nabble.com/How-to-use-a-RollingFileAppender-asynchronously--tp17989557p17989557.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: isErrorEnabled()
It doesn't look like there is an isErrorEnabled method but you could use logger.isEnabledFor(Level.ERROR) Why would you ever disable the error level? James A. N. Stauffer http://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ On Mon, Jun 23, 2008 at 7:25 AM, Konstantin Domoratskyy [EMAIL PROTECTED] wrote: Hi, I use recently log4j. I have an old program. There is here a logger.isErrorEnabled() test before logger.error(...). I don't know when this has been implemented, but now I cannot found isErrorEnabled() in the log4j API for Logger. Is this method now in error(String str) encapsulated? If no, how can I realize this combination else? Thanks and regards Konstantin Domoratskyy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Reg custome log levels
You can map the log4j levels as follows and then just use the standard levels. 0: OFF 1: WARN 2: INFO 3: DEBUG (or TRACE) James A. N. Stauffer http://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ On Mon, Jun 23, 2008 at 3:58 PM, pram [EMAIL PROTECTED] wrote: Hello all, I wrote a java application that processes xml files in a dir, and posts jms messages in a queue. I have the following requirement for logging: Take logging level as one of the config parameters and do the logging accordingly. For example: The log-level can be 0-(no logging), 1-(errors/warnings only), 2-(1+significant info included, like jms message picked, jms message processed etc), 3-(2+message text included) Can anybody please suggest a good way of achieving this? Should I use the log4j standard logging levels, or define my own custome levels? Thanks, Pram -- View this message in context: http://www.nabble.com/Reg-custome-log-levels-tp18078351p18078351.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Logging levels per workstation
If each workstation is running log4j then you can just use a different config file. James A. N. Stauffer http://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ On Mon, Jun 30, 2008 at 9:25 AM, Chris Gilliam [EMAIL PROTECTED] wrote: Hello All, I am looking at using Log4J for a project I am working on. I am just curious if there is a way to configure Log4J so I can have different workstation logging at different levels. This would be the great for support while they are working on a problem so they can turn up the level for a specific workstation vs the whole application and bring the server to a crawl while logging a few hundred workstations. Thanks in advance. Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: using log4j with OAS for some reasone all the logging activity hangs from all the applications deployed
The sub-applications may be trying to reconfigure logging. Run with -Dlog4j.debug to see if that is happening. James A. N. Stauffer http://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ On Mon, Jun 30, 2008 at 9:32 AM, Amgad Mohamed [EMAIL PROTECTED] wrote: Dear All, I'm using log4j to log the events that appears in a certain application under Oracle Application Server. This application includes sub-application but all are sharing the same log4j properties file. For some reasons the logging in all sub-applications stops and I don't know why. FYI each sub-application logs in a different file, and there are some sub-applications connects to other platform throw http. To make the logging work again I have to restart the OC4J in which this application is deployed in the OAS. Regards, Amgad Muhammad Software Engineer GoodNews4Me Tel: +2 02 2792 40 40 ext. 426 Fax: +2 02 2795 89 38 2 Abdel Kader Hamza St., Garden City Cairo, Egypt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to Prevent Empty Log Files?
I don't think so. James A. N. Stauffer http://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ On Mon, Jun 9, 2008 at 2:15 PM, Reza Sherafat [EMAIL PROTECTED] wrote: Hi, I was wondering if there is a way to instruct log4j to postpone creation of log files, until there is actually something being logged (written to the file). I want to prevent creation of empty log files - created at startup. I think the changing log levels does not solve this problem, since log files will be created first anyway and remain empty. Thanks in advance, Reza _ If you like crossword puzzles, then you'll love Flexicon, a game which combines four overlapping crossword puzzles into one! http://g.msn.ca/ca55/208 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Including log4j in war file
That fits with how I understand the configuration. If you include log4j.jar in your war then the classloader will use that jar instead of the jar in common/lib and will use the config in the war also. On Wed, Jun 4, 2008 at 2:34 PM, Serroul, Carol [EMAIL PROTECTED] wrote: Good afternoon, I debated which list to send this to as I'm not sure if it is a tomcat issue or a log4j one. We have a tomcat environment (5.5.25) with log4j-1.2.14.jar located in common/lib. Each app that we deploy generally has a log4j.properties file to configure it's own logging. What we've found is that if we don't include the log4j file in the war file for each application, all of our logging output goes to tomcat.log. If we deploy a log4j jar file with our war file, the logging works correctly. Have any of you run into anything similar? I can send whatever config files might be necessary but don't want to pre-emptively flood you with information. Thanks! Carol Serroul | Senior Systems Analyst | Analyste principal des systèmes 613-993-2667 | facsimile / télécopieur 613-991-2857 | [EMAIL PROTECTED] CISTI, National Research Council Canada | 1200 Montreal Road Ottawa ON K1A 0R6 ICIST, National Research Council Canada | 1200, chemin Montréal Ottawa ON K1A 0R6 Government of Canada | Gouvernement du Canada -- James A. N. Stauffer http://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Various fields in log4j.properties
You might for the XML DTD helpful (but I don't know if there is a spec for .properties) http://svn.apache.org/viewvc/logging/log4j/trunk/src/main/resources/org/apache/log4j/xml/log4j.dtd?view=markup On Thu, May 8, 2008 at 1:02 AM, lp_1431 [EMAIL PROTECTED] wrote: Kindly please let me know all the fields that can be put in the log4j.properties file. Thanks -- View this message in context: http://www.nabble.com/Various-fields-in-log4j.properties-tp17120176p17120176.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Stauffer http://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Logging internal problems with the DailyRollingFileAppender
LogLog doesn't use the log4j config to log. If it did then there would be recursive error problems. On Fri, May 9, 2008 at 8:46 PM, Vincenzo Vitale [EMAIL PROTECTED] wrote: Hi, in our system (Jboss on Linux) we log in a custom file on a remote machine; the directory is normally mounted in a way that if something happen Jboss doesn't hang. But it's an important requirement that if for any reason something happen while logging (directory or file not anymore available) an error or warnign message should be logged on the normal log file. Looking at the code of the LogLog class, I have seen that the log4j.debug system variable can be enabled for internal debugging messages but this kind of problems should be logged as Errors or warning, right? So only the quietMode variable is considered... but when I umount the directory or just change the filename nothing is logged. I see that everything is logged on the System error but this should be redirect to the normal log or not? -- James A. N. Stauffer http://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Moving log statements from file to database.
Write the logs in XML format (to make it easier to parse) and then write a program to parse and write to the DB. On Mon, May 12, 2008 at 12:56 AM, Duseja, Sushil [EMAIL PROTECTED] wrote: Hello, I have written a custom appender using Axis and log4j. This appender calls my web service. Following is what happens:- * If the service is up, it writes the logging statements to one of the tables in the database. * If the service is down, it writes the logging statements to a file on the file system. (This is done so that the log statements are not missed.) Now, when the service comes up again, the log statements in the file (which were meant to go into the database table originally) should be written back to the database. Can anyone please let me know as to how to go about it? Thanks. Regards, Sushil Duseja -- James A. N. Stauffer http://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Combining log4j and log4net
file: No port: yes but I don't know if the format is the same. On Tue, May 13, 2008 at 2:51 AM, [EMAIL PROTECTED] wrote: Hi, We have an application set consisting of both java and .net applications. Is it possible to have separate log4j and log4net instrumented applications simultaniously writing to the same text log file or to the ip port ? /Geir ** The contents of this e-mail message and any attachments are confidential and are intended solely for the addressee. If you have received this transmission in error, please immediately notify the sender by return e-mail and delete this message and its attachments. Any unauthorized use, copying or dissemination of this transmission is prohibited. Neither the confidentiality nor the integrity of this message can be vouched for following transmission on the Internet. ** -- James A. N. Stauffer http://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Appender events and levels.
Your info doesn't seem to jive. It appears that you are appending to the subject in a loop or something to get multiple paranthesis. On Tue, May 13, 2008 at 4:30 PM, Tasso Angelidis [EMAIL PROTECTED] wrote: I wrote my own SMTP appender as I required some additional functionality. Bassically in void append(LoggingEvent event) I want to append the Level to the subject of the email. String subject = new String(My Subject); subject += ( + event.getLevel().toString() + ); In my application: opsLogger.info(test1); Produces subject: My Subject (ERROR) (INFO) opsLogger.error(test2); Produces subject: My Subject (ERROR) opsLogger.warn(test3); Produces subject: My Subject (ERROR) (INFO) (WARN) How can I get the appender to only write the specific Level not the hiarchy. -- James A. N. Stauffer http://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Configuration through Database
Store the XML in a clob and use org.apache.log4j.xml.DOMConfigurator.configure(org.w3c.dom.Element element) before making any other log4j calls. On Tue, May 13, 2008 at 11:22 PM, Mitesh Mehta [EMAIL PROTECTED] wrote: I would like to configure log4j using a Database (i.e. my properties or XML file would reside in a DB). Has that been done by anyone OR does anyone have suggestions? The requirement comes from security rules make direct file access for configuration changes difficult, but allow us to build a simple UI to update the configuration directly in the database. Thanks. -- James A. N. Stauffer http://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: log history limit
Consider having a cron job or scheduled task that deletes files older than 8 days. On Tue, May 20, 2008 at 8:26 AM, [EMAIL PROTECTED] wrote: I am using Log4j in my project and have configured a file appender in it. My problem , log4j is creates a new file for logging purpose every day and backs up the last day log in a separate file and name is it with its respective date. I want to limit this behavior of log4j for last eight days so that I can save the disk space. I mean to say I want log4j to maintain the history of log for last eight days. Can any please help me in this regards. Following is the detail of my log4j.properties file: -- James A. N. Stauffer http://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Thread specific appender for webapp (also using separate log files for threads)
You might be able to extend FileAppender On Wed, May 28, 2008 at 9:23 AM, Armin Häberling [EMAIL PROTECTED] wrote: Curt Arnold wrote: On May 26, 2008, at 6:52 AM, Armin Häberling wrote: Hi all, I'm facing the following problem. We have a tomcat instance with multiple webapps. The apps share many libraries in shared/lib directory, some of them use log4j and some apache commons-logging. Currently all the apps log to the same log file, which is suboptimal. We like to have one log file per webapp. AFAIK one solution for this is to put for each webapp a log4j jar in the WEB_INF/lib directory and a separate log4j.properties. As far as I understand the tomcat classloader hierarchy, all libraries in shared/lib that use log4j must then also be moved to WEB_INF/lib directory of the webapp. (please correct me if I'm wrong!). Unfortunately this is not possible in our specific case. As a second solution I thought of an appender, that writes to different files, based on the caller thread. It should be possible to extend this to have different log files per webapp. Has anyone already done such a thing? Any hints how this can be easily implemented? I guess I have write a new Appender extending AppenderSkeleton. Thanks in advance! Armin Both this and the using separate log files for threads question would be good uses for the MultiFileAppender effort that started in the sandbox a couple of years ago but stalled due to my time constraints and the lack of any other contributors. It was not left in a usable state, but the major design ideas should be visible. I have had good intentions to return to complete it. The code is in http://svn.apache.org/repos/asf/logging/sandbox/log4j/multifile. Search the list for multifile for previous discussions. Basically, the idea is that a FileNamePolicy examines each LoggingEvent and returns the corresponding file name. The append manages a set of open files making sure that the number of open files does not exceed a fixed limit and that files are closed after some extended period of inactivity. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Hi Curt, This sounds good. I had a look at the code. Basically what remains to do is to implement the actual MultiFileAppender class. Once this done it should be easy to write a custom FileNamePolicies. I don't know the log4j code well. But with some help, I could create an initial implementation of the MultiFileAppender. Have you already done some sort of detail design for the MultiFileAppender? Is there some code in log4j that I could reuse for the MultiFileAppender, other than AppenderSkeleton? Armin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Stauffer http://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: two appenders logging to the same file with different levels and message patterns
The rolling would probably happened based on if the appender processing the current event thought it should be rolled. On Wed, May 28, 2008 at 12:15 PM, Alec Lebedev [EMAIL PROTECTED] wrote: I have two pieces of code which I want to log messages to the same file, but use different pattern format. I created two RollingFileAppender appenders, one - for each pattern format. Both appenders log to the same file. Is this safe to do? If this is safe to do, then let's assume that the first appender has MaxFileSize 1MB and MaxBackupIndex of 10, another appender has MaxFileSize 2MB and MaxBackupIndex of 20. How would the log file grow in this case? If this is not safe to do, then how can I have two pieces of code log into the same file, but have different log levels and message patterns? Thanks. Alec -- James A. N. Stauffer http://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: SMTPAppender not send a specific ERROR log
Is it possible that the email appender doesn't see the logs from MemoryWarningSystem because of being on a different trunk of the logger tree? On Fri, May 30, 2008 at 12:12 PM, Stephen More [EMAIL PROTECTED] wrote: I have configured log4j.xml with a appender name=email class=org.apache.log4j.net.SMTPAppender that is emailing out all ERROR messages except for one specific error. I have added a MemoryWarningSystem to a tomcat servlet. ( http://www.javaspecialists.eu/archive/Issue092.html ) public void init() throws javax.servlet.ServletException { _log.trace( Executing INIT ); MemoryWarningSystem.setPercentageUsageThreshold( 0.1 ); mws = new MemoryWarningSystem(); mws.addListener( new MemoryWarningSystem.Listener() { public void memoryUsageLow( long usedMemory, long maxMemory ) { double percentageUsed = ((double) usedMemory) / maxMemory; _log.error(Memory percentageUsed = + percentageUsed); MemoryWarningSystem.setPercentageUsageThreshold( 0.2 ); } }); } My file appender shows 2008-05-30 13:01:13,083 ERROR [MonitorServlet:24] Memory percentageUsed = 0.10273910155216874 but I get no email. ( I do get other ERROR emails ). What is the best way I can get this working ? -Thanks Steve More - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Stauffer http://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Logging internal problems with the DailyRollingFileAppender
Redirect standard out and standard error. But don't send them to log4j. On Tue, Jun 3, 2008 at 4:01 PM, Vincenzo Vitale [EMAIL PROTECTED] wrote: Hi James, thanks for your answer. How can I configure where LogLog write the logs? On Tue, Jun 3, 2008 at 10:05 PM, James A. N. Stauffer [EMAIL PROTECTED] wrote: LogLog doesn't use the log4j config to log. If it did then there would be recursive error problems. On Fri, May 9, 2008 at 8:46 PM, Vincenzo Vitale [EMAIL PROTECTED] wrote: Hi, in our system (Jboss on Linux) we log in a custom file on a remote machine; the directory is normally mounted in a way that if something happen Jboss doesn't hang. But it's an important requirement that if for any reason something happen while logging (directory or file not anymore available) an error or warnign message should be logged on the normal log file. Looking at the code of the LogLog class, I have seen that the log4j.debug system variable can be enabled for internal debugging messages but this kind of problems should be logged as Errors or warning, right? So only the quietMode variable is considered... but when I umount the directory or just change the filename nothing is logged. I see that everything is logged on the System error but this should be redirect to the normal log or not? -- James A. N. Stauffer http://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Stauffer http://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: can log4j overwriting and wrong time/date rollover
You can't have 2 JVMs writing to the same file. You could use a system property to make them write to different files. On Thu, Apr 24, 2008 at 4:25 AM, wesleywj2 [EMAIL PROTECTED] wrote: hi everyone, i faced with a rather weird outcome of log4j. first of all to load preface information, i'm using apache2.2 and load balanced 2 tomcat version 6 called tomcat1 tomcat2 respectively. i made the tomcat1 2 point to a single webapp directory. rough diagram looks like this: Apache2.2 | - || tomcat1tomcat2 | | - | webapps as depicted above, any request send from apache to tomcat1 and tomcat2 will use the same copy of servlet within the webapps/WEB-INF/classes dir. i set the log file to eg. /log/mylog.log. the log4j settings is as below. p log4j.rootLogger=DEBUG,DAILY log4j.appender.DAILY=org.apache.log4j.DailyRollingFileAppender log4j.appender.DAILY.layout=org.apache.log4j.PatternLayout log4j.appender.DAILY.File=/log/mylog.log log4j.appender.DAILY.Append=true log4j.appender.DAILY.DatePattern='.'-MM-dd-HH log4j.appender.DAILY.layout.ConversionPattern=%d %-5p [%t] %-17c{2} %3x - %m%n /p based on the setting above, it should log every top hour per file. There are 2 problems i'm facing now: 1. It logs every hour as expected. But the name of the file where hour indicated differently than the contents being log. eg. filename is mylog.log.2008-04-20-13 indicate 1pm. but the contents inside logs 2pm onwards. 2. Log4j normally rollover and copy a new past hour to a new file. Leaving the default mylog.log as the current logging data before rollover and copy to another file (that is, currently logging 2pm onwards). But i saw it logging both files at the same time in mylog.log and mylog.log.2008-04-20-13. The file mylog.log logging 2pm onwards which is correct but it still log 2pm onwards /append the same information to mylog.log.2008-04-20-13. i suspect it might be something to do with concurrency/thread issue while logging the file. +has anyone ever come across any of this? +did i not do correctly on the log settings? +can DailyRollingFileAppender actually handle this rollover issue? please, this is rather headache to me and anyone would be kind enough to give me a pointer to overcome this. Thanks. Wesley -- View this message in context: http://www.nabble.com/can-log4j-overwriting-and-wrong-time-date-rollover-tp16848372p16848372.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Stauffer http://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem in showing Filename and Line number in log file
The class files probably aren't compiled with debug info turn on. On Mon, Apr 28, 2008 at 5:05 AM, Chanchal Verma [EMAIL PROTECTED] wrote: Hi. I am using Log4j ver 1.2.8 here sometime I get question mark instead of file name and line number see below for details -- James A. N. Stauffer http://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Reading log4j properties dynamically from log4j API
You might want to check how LogWeb does it. On Tue, Apr 29, 2008 at 11:41 AM, smpub2000 [EMAIL PROTECTED] wrote: I have an ear file that has log4j.properties conf file. I want to get all the log4j loggers (i.e categories) defined in the properties file. How can I get this through the log4j api? Example log4j.properties: src packages: log4j.category.com.foo=debug log4j.category.com.foo.bar=error I want to get the keys com.foo and com.foo.bar. I want to use these later as arguments to Logger.getLogger(method) and call setLevel(targetLevel) on it. If I call LogManager.getCurrentLoggers(), it only retrieves the Logger instances created by Classes, but not the package level loggers that are defined in the log4j.properties file. Thanks, SM. -- View this message in context: http://www.nabble.com/Reading-log4j-properties-dynamically-from-log4j-API-tp16964256p16964256.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Stauffer http://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to log to a dynamic folder
This will achieve that: http://stauffer.james.googlepages.com/DateFormatFileAppender.java On Thu, Apr 17, 2008 at 1:50 PM, Hei Chan [EMAIL PROTECTED] wrote: Hi, I am like to log4j. I just wonder whether it is possible to log a different file in a different directory based on the hour, day, month, and year. WhatI am trying to achieve is to log to a file at [some path]/[currentyear]/[current month]/[current day], and the file name will be thecurrent hour. I have looked into DailyRollingFileAppender. Itallows me to append the time to the filename. But it is not exactlywhat I want. Is there a way to configure log4j to log to a file based on the current year, month, day and hour? Thanks in advance. Cheers, Hei Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ -- James A. N. Stauffer http://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: No appenders could be found for logger (com.sun.faces.config.ConfigureListener). Please initialize the log4j system properly.
I think log4j.properties should be in WEB-INF/classes On Fri, Apr 11, 2008 at 3:07 AM, Brokenbone [EMAIL PROTECTED] wrote: Hi I'm trying to configure log4j in my web application (built with Oracle ADF (JSF)). I've copied the jar into WEB-INF/lib folder, created log4j.properties file and put it to WEB-INF folder and modified orion-application.xml by adding imported-shared-libraries remove-inherited name=apache.commons.logging /remove-inherited /imported-shared-libraries When I deploy this application to Oracle AS and restart opmn I can see the log file saying (I've enabled oc4j debug) 08/04/11 09:10:28 log4j: Trying to find [log4j.xml] using context classloader SSNApplication.root:0.0.0. 08/04/11 09:10:28 log4j: Trying to find [log4j.xml] using api:1.4.0 class loader. 08/04/11 09:10:28 log4j: Trying to find [log4j.xml] using ClassLoader.getSystemResource(). 08/04/11 09:10:28 log4j: Trying to find [log4j.properties] using context classloader SSNApplication.root:0.0.0. 08/04/11 09:10:28 log4j: Trying to find [log4j.properties] using api:1.4.0 class loader. 08/04/11 09:10:28 log4j: Trying to find [log4j.properties] using ClassLoader.getSystemResource(). 08/04/11 09:10:28 log4j: Could not find resource: [null]. 08/04/11 09:10:28 log4j:WARN No appenders could be found for logger (com.sun.faces.config.ConfigureListener). 08/04/11 09:10:28 log4j:WARN Please initialize the log4j system properly. 08/04/11 09:10:33 Oracle Containers for J2EE 10g (10.1.3.3.0) initialized I've even tried modifying boot.xml found in oc4j.jar library by adding code-source path=${oracle.home}/lib/log4j-1.2.15.jar/ but the warnings are still there. My log4j.properties file is picked by the server (as I can see using File Monitor) and it looks like this: # Set root logger level to DEBUG and its only appender to A1. log4j.rootLogger=ERROR, A1, A2 log4j.logger.my_package_prefix=INFO log4j.logger.oracle=WARNING # A1 is set to be a ConsoleAppender. log4j.appender.A1=org.apache.log4j.ConsoleAppender # A1 uses PatternLayout. log4j.appender.A1.layout=org.apache.log4j.PatternLayout # OLD: %-4r [%t] %-5p %c %x - %m%n log4j.appender.A1.layout.ConversionPattern=%-5p %c %x - %m%n # A2 is set to be a RollingFileAppender. log4j.appender.A2=org.apache.log4j.RollingFileAppender log4j.appender.A2.layout=org.apache.log4j.PatternLayout log4j.appender.A2.layout.ConversionPattern=%d{dd.MM. HH:mm:ss} [%t] (%F:%L) %-5p %c %x - %m%n log4j.appender.A2.File=../SSN/log/my_package_prefix.log log4j.appender.A2.Threshold=INFO log4j.appender.A2.ImmediateFlush=true log4j.appender.A2.Append=False log4j.appender.A2.MaxFileSize=1KB log4j.appender.A2.MaxBackupIndex=5 I'd appreciate any tips on what I'm doing wrong here since I'm struggling with this for a while now. Thank you in advance. BB -- View this message in context: http://www.nabble.com/No-appenders-could-be-found-for-logger-%28com.sun.faces.config.ConfigureListener%29.-Please-initialize-the-log4j-system-properly.-tp16626789p16626789.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Stauffer http://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Specify Repository
] wrote: I've checked the archives and didn't find an answer, but please forgive me if this a duplicate post. I would like to be able to specify a repository for my logger to use. For example: Logger logger = new Logger(my.class.name, myRepositoryName); I read Chapter 8, Extending log4j, and it said that subclassing Logger is a bad idea. I don't see a way to accomplish what I want by wrapping Logger. So, I think, that the only way to do it would be to tweak a few of the log4j classes (i.e. Logger, LogManager, RepositorySelector, and DefaultRepositorySelector). Would anyone be interested in this, or am I barking up the wrong tree? I realize that this could open a can of worms with a lot of repositories getting created, but, if we're carful, this could be very useful. Thanks, Robert Pepersack Senior Lead Developer Maryland Insurance Administration 410-468-2054 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Stauffer http://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Specify Repository
If you provide the reason for your request we might be able to help better. On Wed, Apr 9, 2008 at 10:58 AM, Robert Pepersack [EMAIL PROTECTED] wrote: I've checked the archives and didn't find an answer, but please forgive me if this a duplicate post. I would like to be able to specify a repository for my logger to use. For example: Logger logger = new Logger(my.class.name, myRepositoryName); I read Chapter 8, Extending log4j, and it said that subclassing Logger is a bad idea. I don't see a way to accomplish what I want by wrapping Logger. So, I think, that the only way to do it would be to tweak a few of the log4j classes (i.e. Logger, LogManager, RepositorySelector, and DefaultRepositorySelector). Would anyone be interested in this, or am I barking up the wrong tree? I realize that this could open a can of worms with a lot of repositories getting created, but, if we're carful, this could be very useful. Thanks, Robert Pepersack Senior Lead Developer Maryland Insurance Administration 410-468-2054 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Stauffer http://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how to make a TimeStamp as log4j file name ?
Can you provide an example of what you want? http://stauffer.james.googlepages.com/DateFormatFileAppender.java might work. On Mon, Mar 31, 2008 at 2:05 AM, msg2ajay [EMAIL PROTECTED] wrote: hi, Can we make a Timestamp as a file name in log4j. I have googled it and i tried some ways but not able to do. Do any one know about this. -- View this message in context: http://www.nabble.com/how-to-make-a-TimeStamp-as-log4j-file-name---tp16392861p16392861.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Stauffer http://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: multi-user application and concurrent logging
You can have the clients send the logs to the server with a SocketAppender. On Fri, Mar 28, 2008 at 9:09 AM, çağla okutan [EMAIL PROTECTED] wrote: Hi to all; Our application has a two-tier architecture in which all application logic lies in client. Is it possible to use log4j for producing logs of users' actions and to store the log in server without any concurrency problems? -- - cagla okutan - -- James A. N. Stauffer http://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/
Re: DailyRollingFileAppender - force rollover
I think the next version of log4j is supposed to support that but you would have to write your own appender to get that in the current version. On Thu, Mar 27, 2008 at 5:24 AM, Gerrit Grobbelaar [EMAIL PROTECTED] wrote: Hi all, Is there a config way of telling the appender to rollover not only when there is log activity, but also when the time goes from AM to PM (midday) and from PM to AM (midnight) automatically without any log activity at those times? Any input is greatly appreciated, Gerrit - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Stauffer http://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: RollingFileAppender broken
Try using forward slashes and setting debug to true. On Thu, Mar 27, 2008 at 3:07 PM, Eric Hamacher [EMAIL PROTECTED] wrote: Hello: I cannot get my log4j to log to a file. It will log to the console. Below is my log4j.xml. Any ideas? Thanks. log4j:configuration xmlns:log4j=http://jakarta.apache.org/log4j/; debug=false appender name=FILE class=org.apache.log4j.RollingFileAppender param name=File value=c:\log\A3.log/ param name=Append value=true/ layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%d{dd MMM HH:mm:ss} - [%C.%M] - %p - %m%n/ /layout /appender appender name=CONSOLE class=org.apache.log4j.ConsoleAppender param name=Target value=System.err/ param name=Threshold value=DEBUG/ layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%d{ABSOLUTE} %-5p [%c{1}] %m%n/ /layout /appender category name=com.enetrix.sis priority value=DEBUG/ appender-ref ref=FILE/ appender-ref ref=CONSOLE/ /category /log4j:configuration Regards, Eric Hamacher ** THIS EMAIL IS INTENDED ONLY FOR THE REVIEW OF THE ADDRESSEE(S), AND MAY CONTAIN CONFIDENTIAL AND LEGALLY PRIVILEGED INFORMATION. INTERCEPTION, COPYING, DISSEMINATION, OR OTHER USE BY OTHER THAN THE ADDRESSEE(S) IS PROHIBITED AND MAY BE PENALIZED UNDER APPLICABLE PRIVACY LAWS. IF YOU RECEIVED THIS EMAIL IN ERROR, PLEASE DELETE IT AND NOTIFY ME BY RETURN EMAIL TO [EMAIL PROTECTED] *** -- James A. N. Stauffer http://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: log4j directory creation
Log4j appenders don't create directories. An appender that I ahve written does create directories or you could create your own appender. http://stauffer.james.googlepages.com/DateFormatFileAppender.java On Tue, Mar 25, 2008 at 5:54 AM, Sairam Krishnamurthy [EMAIL PROTECTED] wrote: Hi, I tried to use log4j for my application. I am new to log4j and at first I created a new application to get familiar with log4j. The following is the appender's properties in log4j.property file. log4j.appender.A2=org.apache.log4j.FileAppender log4j.appender.A2.File=c:/demo1/demo2/app.log log4j.appender.A2=org.apache.log4j.RollingFileAppender # Append to the end of the file or overwrites the file at start. log4j.appender.A2.Append=true log4j.appender.A2.layout=org.apache.log4j.PatternLayout log4j.appender.A2.layout.ConversionPattern=[%5p] %d{mm:ss} (%F:%M:%L)%n%m%n%n A2 is the logger appender i use. I dint have demo1/demo2 folder in C:. When i used this log4j configuration in my sample application it was a success with demo1/demo2 folder created by log4j. But when i tried to use the same configuration in my application it gives the following error. log4j:ERROR setFile(null,true) call failed. java.io.FileNotFoundException: test\app.log (The system cannot find the path specified) at java.io.FileOutputStream.openAppend(Native Method) at java.io.FileOutputStream.init(Unknown Source) at java.io.FileOutputStream.init(Unknown Source) at org.apache.log4j.FileAppender.setFile(FileAppender.java:282) at org.apache.log4j.RollingFileAppender.setFile(RollingFileAppender.java:165) at org.apache.log4j.FileAppender.activateOptions(FileAppender.java:161) at org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:256) at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:132) at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:96) at org.apache.log4j.PropertyConfigurator Also when i changed the filename = app.log with no folder name, the log file is creating in my source folder. So the problem was with the creation of directory. Can somebody help me in this? Thanks in advance. -- == Sairam Krishnamurthy Engineer-Platform Email: [EMAIL PROTECTED] Phone: +91-44-45544660 +91-80-41810800 +91-9840194528 +91-9916420081 +1-650-204-9766 IM: [EMAIL PROTECTED] Address Diamond Business Park, First Floor, 17 A Kalakshetra Road, Tiruvanmiyur, Chennai - 600 041. == == -- James A. N. Stauffer http://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Converting Legacy application to use log4j
I think log4j has some support for 3rd party loggers so it can do the work of determining the calling class but I don't remember the details. If Common.status updates the GUI I would level all calls to it the same. Then it is up to you to change all calls to Common.debug to Logger.debug depending on how much work that would be. On Tue, Mar 25, 2008 at 8:08 AM, Clinton Weiss [EMAIL PROTECTED] wrote: I'm seeking some advice here. I have a legacy application with it's own built in logging system accessed via Common.status(String) and Common.debug(String). The status method is used to update the application GUI's status line so the user has some idea of what is going on, it also emits the String to System.out. The debug message just emits the String to System.out. Now, I'd like to replace this setup with log4j, however, the pitfall is how do I still let the user know what is going on? I believe I have a couple of choices here: 1) Import log4j only in the Common class, and still allow all code to call the status() and debug(). When status or debug are called, it will inspect the current thread to see which class to pass to the logger and create (or use a mapped) logger accordingly. This would probably be the easiest, but not the correct way of doing it. 2) Replace all Common.status(String) and Common.debug(String) calls with logger.info(String) and logger.debug(String). However, can I create a class that will listen for logger.info(String) calls and then can update the GUI's status accordingly? This, I presume, would be the correct way of doing it - if it is at all possible. 3) Of course, you might have a better approach that I haven't thought of yet. This in-house-only application has a pluggable architecture that accepts three different types of Interface classes, which is why there is a single place for logging. When I wrote it three years ago I was still very early in Java and hadn't learned of the tools available to me just yet. Lately, I've been planning an overhaul of this application and implementing log4j is a high priority. All existing plugins are kept in a central repository, therefore updating them to the new logging mechanism, if necessary, will be easy. Any ideas? Clinton -- Clinton V. Weiss Programming Services Phone: 586-752-9671 Ext 143 Fax: 586-752-6589 www.custdata.com CONFIDENTIALITY NOTICE: This email contains information from the sender that may be CONFIDENTIAL, LEGALLY PRIVILEGED, PROPRIETARY or otherwise protected from disclosure. This email is intended for use only by the person or entity to whom it is addressed. If you are not the intended recipient, any use, disclosure, copying, distribution, printing, or any action taken in reliance on the contents of this email, is strictly prohibited. If you received this email in error, please contact the sending party by replying in an email to the sender, delete the email from your computer system and shred any paper copies of the email you printed. -- James A. N. Stauffer http://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Suppressing stacktrace output
:-)) Sorry about that. I thought it would still put line breaks between logs. Now I see it wasn't a very useful suggestion. On Fri, Mar 21, 2008 at 8:17 PM, jimski [EMAIL PROTECTED] wrote: James A. N. Stauffer wrote: Try removing the %n and anything else after %m. Hi James- that approach did work but newlines are critical for making the log file readable, particularly on the console. -- View this message in context: http://www.nabble.com/Suppressing-stacktrace-output-tp16145551p16213313.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Stauffer http://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Suppressing stacktrace output
I think the layout determines if the stack trace is logged. How are you configuring the console appender? On Wed, Mar 19, 2008 at 9:58 AM, jimski [EMAIL PROTECTED] wrote: Hi- I've defined two appenders for my application: a console and a file appender. Throughout my code I've been using the convention of logging a message along with a throwable so that I could output the stacktrace for diagnostic purposes. I'd like to suppress the stacktrace output for the console appender but can't find any way to do that that allows me to keep all my logging statements as is. I found one unacceptable workaround where, for each logged exception I could do the following: log.info(Some custom message); log.debug(Some custom message, e); and then set up appropriate filter levels on each appender. Does someone have a solution that would allow me to simply turn off stacktrace output for a specific appender? Thanks, Jim -- View this message in context: http://www.nabble.com/Suppressing-stacktrace-output-tp16145551p16145551.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Stauffer http://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Adding a custom variable to Log4j logging calls
Is there a reason why appending the strings doesn't work? I think you can use format messages. On Wed, Mar 19, 2008 at 9:57 AM, dertown [EMAIL PROTECTED] wrote: Hi Everyone I am newbi with log4j , i was wondering if there is any example code on how to add a custom variable to a log4j logging call. the default is log.log(DEBUG,log message); I would like to add another custom variable here to allow for some additional information. so the new log call will be log.log(DEBUG,log message,more info); Thanks Derek -- View this message in context: http://www.nabble.com/Adding-a-custom-variable-to-Log4j-logging-calls-tp16145549p16145549.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Stauffer http://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Async appender and database logging
I don't know if the AyscAppender has been fixed in that version. Can you show how you are configuring the AyscAppender and DBAppender? On Wed, Feb 20, 2008 at 10:11 AM, Andreas Grund [EMAIL PROTECTED] wrote: Hi, I'm sorry, I forget to mention, that I use log4j-1.3-alpha8 in my application. Greetings, Andreas -Ursprüngliche Nachricht- Von: James A. N. Stauffer [mailto:[EMAIL PROTECTED] Gesendet: Mi 20.02.2008 17:06 An: Log4J Users List Betreff: Re: Async appender and database logging Beware that AsyncAppender had bugs and I think you need 1.2.15 to get the fix. On Wed, Feb 20, 2008 at 9:40 AM, Andreas Grund [EMAIL PROTECTED] wrote: Hi Mailinglist, I tried to log into a oracle database using the existing DBAppender. To get a little bit more performance and to ensure, that my application is not block during logging, I wrapped the DBAppender in my configuration with a Async Appender. But this causes some problems. I got reproducable a SQLException, that the connection to the database could not be established. This problem does not occur, if I remove the Async appender. Does anybody know, if there is a known problem describing this situation? Or is there a possibility to configure a max number of connections to the database and that I log to many messages, so that this max number of connections is excessed? Thanks for your help! Greetings, Andreas -- Andreas Grund externer Mitarbeiter Projet GUTS bei Conti mailto:[EMAIL PROTECTED] Mobile: Germany Phone: Fax: Geschäftsführer: Ingo Kriescher Amtsgericht Düsseldorf HRB48672 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Stauffer http://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Async appender and database logging
Beware that AsyncAppender had bugs and I think you need 1.2.15 to get the fix. On Wed, Feb 20, 2008 at 9:40 AM, Andreas Grund [EMAIL PROTECTED] wrote: Hi Mailinglist, I tried to log into a oracle database using the existing DBAppender. To get a little bit more performance and to ensure, that my application is not block during logging, I wrapped the DBAppender in my configuration with a Async Appender. But this causes some problems. I got reproducable a SQLException, that the connection to the database could not be established. This problem does not occur, if I remove the Async appender. Does anybody know, if there is a known problem describing this situation? Or is there a possibility to configure a max number of connections to the database and that I log to many messages, so that this max number of connections is excessed? Thanks for your help! Greetings, Andreas -- Andreas Grund externer Mitarbeiter Projet GUTS bei Conti mailto:[EMAIL PROTECTED] Mobile: Germany Phone: Fax: Geschäftsführer: Ingo Kriescher Amtsgericht Düsseldorf HRB48672 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Stauffer http://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: multiple log4j.properties through dependencies?
If the util project is considered a library than it shouldn't do any config of log4j. If it can run on its own than options include: Tweaking the classpath order. Using xml config because that is used in preference to properties. Load each project in a different classloader. On Wed, Feb 20, 2008 at 11:08 AM, CodingPlayer [EMAIL PROTECTED] wrote: Hi, i just wonder what happens if one has two projects, one of them depending on the other. (Lets say: a util project and an application.) and both of them use a log4j.properties file (with a different config setting, e.g.: log level, console/file, ...) i would guess that the file which comes first in the classpath is taken into consideration. So what is the best approach for such a situation? only use ONE log4j.properties file in the (leaf) application project, and don't use one in the dependent util project? thx 4 help R.C. -- View this message in context: http://www.nabble.com/multiple-log4j.properties-through-dependencies--tp15593675p15593675.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Can't figure out how to log to separate files in Log4J -- Need Ideas
There have been discussions on the list of an appender that creates a different file per value of an MDC key. I think it was in relation to separate files per thread but you could set the MDC key separately in each app and then use that appender. On Fri, Feb 15, 2008 at 7:45 AM, sparky2708 [EMAIL PROTECTED] wrote: I have a system developed in java that has multiple services (i.e. java Applications). I would like to be able to log EACH application to ITS OWN log file. I have about 50-80 applications so having a log4j.properties for each one is not a feasible solution. I would like to use ONE log4j.properties file for the entire suite of application and use the DailyRollingFileAppender preferably to roll each of the log files on a nightly basis so each of the logs doesn't get too big. I didn't think this would be very complicated when I started thinking about this but am now stuck trying to figure out how to accomplish this with log4j. Any ideas? -- View this message in context: http://www.nabble.com/Can%27t-figure-out-how-to-log-to-separate-files-in-Log4JNeed-Ideas-tp15501211p15501211.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Stauffer http://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Roll a Log File on restart of an App run
I wrote an appender that I think could do that. If the separate isn't set then it will create a file only once per run. http://stauffer.james.googlepages.com/DateFormatFileAppender.java On Fri, Feb 15, 2008 at 10:57 AM, Jim Reilly [EMAIL PROTECTED] wrote: Per each restart of an app, I would like to have the ability to have the log files roll (like the RollingFileAppender), so each new run has its own log file run. Is there are my to do this via the log4j config file or another file appender? I could see how that might be difficult to do or problems that may have, but given a preset of conditions for what an Appender like that would be, I 'think' it could work? ;-) Thanks, Jim Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping -- James A. N. Stauffer http://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: dynamic variables/parameters
In an XML config, system properties can be used like ${catalina.base}. On Wed, Feb 13, 2008 at 5:23 PM, osubb [EMAIL PROTECTED] wrote: I am pretty new to log4j and have a question that should be easy. I am using log4j in a web (java servlets) environment. 1) How do I pass in variables? I have an app that uses the JDBCAppender and would like to pass in the connection values. Is there an easy way to do this? These values could be different for each client that access the Servlet(s). Is there a pattern for this type of scenario? At this point, I have to hardcode the URL, user, and password values in the log4j.xml file. I tried using MDC, but this seems to work in the ConversionPattern param for log files and the sql param name for the JDBCAppender. It does not work for the URL, user, and password param values (does not change to MDC value). Any help would be appreciated, osubb -- View this message in context: http://www.nabble.com/dynamic-variables-parameters-tp15470530p15470530.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Stauffer http://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: dynamic variables/parameters
It might help if you could provide more details on why you want the JDBC parameters to vary per connection/thread. On Thu, Feb 14, 2008 at 10:15 AM, osubb [EMAIL PROTECTED] wrote: I don't believe this will work. The system properties are set once the Servlet is started. I will have different parameters for each new connection (thread) of the servlet. I need a way to alter the values for each thread. I thought of using MDC, but that only worked when using the ConversionPatter or using the sql param for JDBCAppender. Is there any way to pass in values to log4j for each client connection (Servlet thread)?? thanks, osubb James A. N. Stauffer wrote: In an XML config, system properties can be used like ${catalina.base}. On Wed, Feb 13, 2008 at 5:23 PM, osubb [EMAIL PROTECTED] wrote: I am pretty new to log4j and have a question that should be easy. I am using log4j in a web (java servlets) environment. 1) How do I pass in variables? I have an app that uses the JDBCAppender and would like to pass in the connection values. Is there an easy way to do this? These values could be different for each client that access the Servlet(s). Is there a pattern for this type of scenario? At this point, I have to hardcode the URL, user, and password values in the log4j.xml file. I tried using MDC, but this seems to work in the ConversionPattern param for log files and the sql param name for the JDBCAppender. It does not work for the URL, user, and password param values (does not change to MDC value). Any help would be appreciated, osubb -- View this message in context: http://www.nabble.com/dynamic-variables-parameters-tp15470530p15470530.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Stauffer http://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/dynamic-variables-parameters-tp15470530p15481252.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Stauffer http://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Help configuring Log4j in a stand-alone app...
If you add -Dlog4j.debug to the command line log4j will print out info about how it is being configured. Also, it appears that you haven't attached the appender to any logger. On Feb 13, 2008 9:01 AM, James Depaul [EMAIL PROTECTED] wrote: Hi folks - I'm frustrated in trying to control the run-time configuration of Log4j in my standalone application. I have log4j-1.2.13.jar in my classpath. I have a log4j.properties file configured as shown below. It seems that I have no idea where to place the property file in my classpath for log4j to find/use it.Right now, it seems that no matter where I put it the logging level is always on INFO, In fact, it's on INFO even if I completely delete the log4j.properties file from the project! Please help me figure out how to properly control the logging level using log4j.properties file - like the one below... I would liket to set the package level control to DEBUG or INFO, etc. Where do I put it, and how do I instruct logging framework to find and use this config file. log4j.properties file - currently located in /target/classes directory: --- ### direct log messages to stdout ### log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.Target=System.out log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n ### set log levels - for more verbose logging change 'info' to 'debug' ### log4j.rootLogger=debug ### debug your specific package or classes with the following example log4j.logger.com.ibm.cods.batch.common.processor.email=debug --- My program has the following statements in it: --- package com.ibm.cods.batch.common.processor.email; import junit.framework.TestCase; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.log4j.BasicConfigurator; import org.apache.log4j.Logger; public class Log4J_TestHarness extends TestCase { private static org.apache.log4j.Logger log = Logger.getLogger(Log4J_TestHarness.class); protected void setUp() throws Exception { super.setUp(); } public void testLog4J_Configuration() { log.info( starting new test case: testLog4J_Configuration()); log.debug(hello from DEBUG!); log.info( end test case: testLog4J_Configuration()); } } --- -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Help configuring Log4j in a stand-alone app...
I don't use a properties file to config so I'm not 100% sure but that is a common thing so a little search should turn up the answer. On Feb 13, 2008 9:43 AM, James Depaul [EMAIL PROTECTED] wrote: If you add -Dlog4j.debug to the command line log4j will print out info about how it is being configured. Right... we're getting closer! Using your suggestion I was able to find the proper place for my file and now I know when it's using it - finally! so thanks Also, it appears that you haven't attached the appender to any logger. Please give an example how to attach an appender to a logger - I'm getting this: log4j:WARN No appenders could be found for logger (com.ibm.cods.batch.common.processor.email.Log4J_TestHarness). log4j:WARN Please initialize the log4j system properly. Thanks! James -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: log4j : How to avoid duplicate logmessages in a multithreaded application?
Then I suggest checking out the log4j debug output to determine exactly what is configuring it. On Feb 3, 2008 11:34 PM, Dvrm Chowdary [EMAIL PROTECTED] wrote: Hi, I tried that, but it didn't work. I tried disabling the console appenders in jboss-log4j.xml too, but in vain. I see duplicates on the console, but i dont find any in the log files.Only the loggers in threads are being duplicated. Regards. James A. N. Stauffer [EMAIL PROTECTED] 02/01/2008 09:44 PM To Dvrm Chowdary/CHE/[EMAIL PROTECTED] cc Subject Re: log4j : How to avoid duplicate logmessages in a multithreaded application? It is possible that the container is causing DOMConfigurator to be called multiple times? Add debug=true to the log4j:configuration XML element and it will print info each time log4j is configured. On Feb 1, 2008 3:09 AM, Dvrm Chowdary [EMAIL PROTECTED] wrote: Hi, DOMConfigurator is being called only at the application starup. I noticed that The number of duplicates of each logger message (those inside threads) keeps on increasing if i leave my application still. I am using many queues configured in the jboss .Has it got to do anything with this weird behaviour? Regards. James A. N. Stauffer [EMAIL PROTECTED] 01/31/2008 08:44 PM To Dvrm Chowdary/CHE/[EMAIL PROTECTED] cc Subject Re: log4j : How to avoid duplicate logmessages in a multithreaded application? How often is DOMConfigurator called? Are you sure it is called once once in the life cycle of the application? On Jan 30, 2008 11:26 PM, [EMAIL PROTECTED] wrote: Hi James, Thanks for the reply.I am configuring log4j using a DOMConfigurator as shown below. I don't know what exactly the configure method does though. DOMConfigurator.configure(prop.getProperty(Log4jConfig)); Is something wrong with it?? Also the number of duplicate logger messages I see is constant(around 8-9) for each logger(only those inside threads). I have 8 appenders in my log4j-config.xml too. Are they adding up? Regards. James A. N. Stauffer wrote: My guess is that log4j is being configured multiple times. Each time log4j is configured, the new configuration is added to the current configuration. How are you configuring log4j? On Jan 30, 2008 3:00 AM, dvrmc [EMAIL PROTECTED] wrote: Hi, I m using log4j for my heavily multithreaded JAVA application. After my application comes up, a few minutes later , I find many duplicate logger messages on the console(only logger messages in threads are being displayed 8-9 times each). Is it that my application being multithreaded or is there something wrong with my configuration file? My log4j-config.xml is as below:- ?xml version=1.0 encoding=UTF-8? !DOCTYPE log4j:configuration SYSTEM log4j.dtd log4j:configuration xmlns:log4j=http://jakarta.apache.org/log4j/; configDebug=true appender name=ASYNC class=org.apache.log4j.AsyncAppender additivity=false appender-ref ref=TEMP/ appender-ref ref=CONSOLE/ appender-ref ref=TRACE/ appender-ref ref=DEBUG/ appender-ref ref=INFO/ appender-ref ref=WARN/ appender-ref ref=ERROR/ appender-ref ref=FATAL/ /appender appender name=CONSOLE class=org.apache.log4j.ConsoleAppender !-- param name=ImmediateFlush value=true/-- layout class=org.apache.log4j.PatternLayout !-- param name=ConversionPattern value=%d %-5p [%t] %C %A (%F:%L) - %m%n/-- /layout /appender appender name=TEMP class=org.apache.log4j.FileAppender layout class=org.apache.log4j.PatternLayout /layout /appender appender name=TRACE class=org.apache.log4j.FileAppender layout class=org.apache.log4j.PatternLayout /layout /appender appender name=DEBUG class=org.apache.log4j.FileAppender layout class=org.apache.log4j.PatternLayout /layout /appender appender name=INFO class=org.apache.log4j.FileAppender layout class=org.apache.log4j.PatternLayout /layout filter class=org.apache.log4j.varia.LevelMatchFilter /filter filter class
Re: Finding which config file was used
Turn on log4j debug output. On Feb 5, 2008 10:10 AM, Olivier Lefevre [EMAIL PROTECTED] wrote: How can one find out, after program initialization, which configuration file was read by log4j at startup? Yes, I could walk the classpath but there has to be a way to get that info from log4j directly. Thanks, -- O.L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: logging only one level of messages
With XML config you can use a LevelFilter and put a cap on the level. On Feb 1, 2008 8:23 PM, Beth Hechanova [EMAIL PROTECTED] wrote: I have a log file that I would like only trace messages written to it. However when I create my properties file such that the logger specifies the trace level, I also get the debug, info, etc. messages in that log file. Is there a way to enforce just trace messages? My properties file looks like: log4j.category.com.xxx.businesslogic =trace, lcdlog log4j.appender.lcdlog=org.apache.log4j.FileAppender log4j.appender.lcdlog.File=/data/logs/lcd.log log4j.appender.lcdlog.layout=org.apache.log4j.PatternLayout log4j.appender.lcdlog.layout.ConversionPattern=[%d{MM/dd/ HH:mm:ss}] %-p - %m%n And of course I have another appender to handle the other log messages. Is it possible to set things up in the properties file to only get the trace messages? I'm using log4j 1.2.15 on a linux system. Thanks, Beth -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: log4j : How to avoid duplicate logmessages in a multithreaded application?
My guess is that log4j is being configured multiple times. Each time log4j is configured, the new configuration is added to the current configuration. How are you configuring log4j? On Jan 30, 2008 3:00 AM, dvrmc [EMAIL PROTECTED] wrote: Hi, I m using log4j for my heavily multithreaded JAVA application. After my application comes up, a few minutes later , I find many duplicate logger messages on the console(only logger messages in threads are being displayed 8-9 times each). Is it that my application being multithreaded or is there something wrong with my configuration file? My log4j-config.xml is as below:- ?xml version=1.0 encoding=UTF-8? !DOCTYPE log4j:configuration SYSTEM log4j.dtd log4j:configuration xmlns:log4j=http://jakarta.apache.org/log4j/; configDebug=true appender name=ASYNC class=org.apache.log4j.AsyncAppender additivity=false appender-ref ref=TEMP/ appender-ref ref=CONSOLE/ appender-ref ref=TRACE/ appender-ref ref=DEBUG/ appender-ref ref=INFO/ appender-ref ref=WARN/ appender-ref ref=ERROR/ appender-ref ref=FATAL/ /appender appender name=CONSOLE class=org.apache.log4j.ConsoleAppender !-- param name=ImmediateFlush value=true/-- layout class=org.apache.log4j.PatternLayout !-- param name=ConversionPattern value=%d %-5p [%t] %C %A (%F:%L) - %m%n/-- /layout /appender appender name=TEMP class=org.apache.log4j.FileAppender layout class=org.apache.log4j.PatternLayout /layout /appender appender name=TRACE class=org.apache.log4j.FileAppender layout class=org.apache.log4j.PatternLayout /layout /appender appender name=DEBUG class=org.apache.log4j.FileAppender layout class=org.apache.log4j.PatternLayout /layout /appender appender name=INFO class=org.apache.log4j.FileAppender layout class=org.apache.log4j.PatternLayout /layout filter class=org.apache.log4j.varia.LevelMatchFilter /filter filter class=org.apache.log4j.varia.DenyAllFilter/ /appender appender name=WARN class=org.apache.log4j.FileAppender layout class=org.apache.log4j.PatternLayout /layout filter class=org.apache.log4j.varia.LevelMatchFilter /filter filter class=org.apache.log4j.varia.DenyAllFilter/ /appender appender name=ERROR class=org.apache.log4j.FileAppender layout class=org.apache.log4j.PatternLayout /layout filter class=org.apache.log4j.varia.LevelMatchFilter /filter filter class=org.apache.log4j.varia.DenyAllFilter/ /appender appender name=FATAL class=org.apache.log4j.FileAppender layout class=org.apache.log4j.PatternLayout /layout filter class=org.apache.log4j.varia.LevelMatchFilter /filter filter class=org.apache.log4j.varia.DenyAllFilter/ /appender appender name=SLCS class=org.apache.log4j.FileAppender layout class=org.apache.log4j.PatternLayout /layout /appender category name=com.aircell.abs.acpu.softwareloadconfig additivity=false level value=debug/ appender-ref ref=SLCS/ /category root priority value=info/ appender-ref ref=ASYNC/ /root /log4j:configuration Regards. -- View this message in context: http://www.nabble.com/log4j-%3A-How-to-avoid-duplicate-logmessages-in-a-multithreaded-application--tp15177220p15177220.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Renaming log file
I'm not sure what you want but RollingFileAppender will make files like what you want. On Jan 27, 2008 10:52 PM, anoobthomas [EMAIL PROTECTED] wrote: Currently I am using Daily Rolling File Appender to generate log files. I want to rename my log file from ABC.log2008-1-27 to ABC.log number sequence , like ABC.log1,ABC.log2 and so on. Should I create a custom appender or are there any appenders that generate this format. If I have to create a custom appender please let me know how to do it. -- View this message in context: http://www.nabble.com/Renaming-log-file-tp15128382p15128382.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Using Log4j in an Applet?
Unless signed and given permission, an applet can only communicate to the server that served the applet class/jar file(s). Therefore the SimpleSocketServer will need to run on the webserver that servered the applet. You need to configure your applet to send the logs over a SocketAppender back to the server. On Jan 11, 2008 4:21 AM, AbelMacAdam [EMAIL PROTECTED] wrote: Hi, For the Applet I develop I want to log events. I found out I should use org.apache.log4j.net.SimpleSocketServer. Am I correct in assuming this SimpleSocketServer can run independently from any Server software? What I don't know is how I inform my Applet where to send its logging information to (or put otherwise, I get the following lines in my Eclipse console: log4j:WARN No appenders could be found for logger (nl.domain.myApp.MyApplet). log4j:WARN Please initialize the log4j system properly. I made a log4j.properties file, and put it in my WEB-INF/classes directory. The contents of this file is: log4j.debug=TRUE log4j.rootLogger=WARN, R log4j.appender.R=org.apache.log4j.RollingFileAppender log4j.appender.R.File=D:/workspace/myApp/myApp.log log4j.appender.R.MaxFileSize=100KB log4j.appender.R.MaxBackupIndex=5 log4j.appender.R.layout=org.apache.log4j.PatternLayout log4j.appender.R.layout.ConversionPattern=%d{HH:mm:ss,SSS} %-5p %c - %m%n I use the following command to start the SimpleSocketServer: java -cp D:\lib\apache-log4j-1.2.15\log4j-1.2.15.jar org.apache.log4j.net.SimpleSocketServer 13013 d:\workspace\myApp\WEB-INF\classes\log4j.properties Stating the obvious, a myApp.log is created in the correct place. There seems to fail something in my log4j.properties file. Something like a server (localhost:13013)? What do I add to this file? TIA Abel -- View this message in context: http://www.nabble.com/Using-Log4j-in-an-Applet--tp14753143p14753143.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Using Log4j in an Applet?
You would use the address that the browser sees so something like http://www.{myserver}.com:13013 On Jan 11, 2008 9:23 AM, AbelMacAdam [EMAIL PROTECTED] wrote: Thanks for your reply. That is what I would like to accomplish, sending logging information to the server. Would there be something like og4j.appender.R.server=http://localhost:13013 or og4j.appender.R.server=http://www.{myserver}.com:13013 I could add to my log4j.properties file? Abel. James A. N. Stauffer wrote: Unless signed and given permission, an applet can only communicate to the server that served the applet class/jar file(s). Therefore the SimpleSocketServer will need to run on the webserver that servered the applet. You need to configure your applet to send the logs over a SocketAppender back to the server. On Jan 11, 2008 4:21 AM, AbelMacAdam [EMAIL PROTECTED] wrote: Hi, For the Applet I develop I want to log events. I found out I should use org.apache.log4j.net.SimpleSocketServer. Am I correct in assuming this SimpleSocketServer can run independently from any Server software? What I don't know is how I inform my Applet where to send its logging information to (or put otherwise, I get the following lines in my Eclipse console: log4j:WARN No appenders could be found for logger (nl.domain.myApp.MyApplet). log4j:WARN Please initialize the log4j system properly. I made a log4j.properties file, and put it in my WEB-INF/classes directory. The contents of this file is: log4j.debug=TRUE log4j.rootLogger=WARN, R log4j.appender.R=org.apache.log4j.RollingFileAppender log4j.appender.R.File=D:/workspace/myApp/myApp.log log4j.appender.R.MaxFileSize=100KB log4j.appender.R.MaxBackupIndex=5 log4j.appender.R.layout=org.apache.log4j.PatternLayout log4j.appender.R.layout.ConversionPattern=%d{HH:mm:ss,SSS} %-5p %c - %m%n I use the following command to start the SimpleSocketServer: java -cp D:\lib\apache-log4j-1.2.15\log4j-1.2.15.jar org.apache.log4j.net.SimpleSocketServer 13013 d:\workspace\myApp\WEB-INF\classes\log4j.properties Stating the obvious, a myApp.log is created in the correct place. There seems to fail something in my log4j.properties file. Something like a server (localhost:13013)? What do I add to this file? TIA Abel -- View this message in context: http://www.nabble.com/Using-Log4j-in-an-Applet--tp14753143p14753143.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/Using-Log4j-in-an-Applet--tp14753143p14758364.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: smtp send file oon file appender roll
AFAIK there is nothing that does that but you could extend the appender to add that feature. On Dec 2, 2007 4:13 PM, mailing list [EMAIL PROTECTED] wrote: HI , is it possible for log4j to email the file before running over it on rolling over ? i haven't been able to find a way to do it thnaks -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/
Re: Changing logging levels in web app
Searc for LogWeb. On Nov 19, 2007 4:48 PM, Warren [EMAIL PROTECTED] wrote: How do I change logging levels without restarting web server. I am running Apache Tomcat. Thanks, Warren Bell Systems Administrator Clark's Nutritional Centers 4225 Market St. Riverside, CA 92501 951-321-1960 ext. 142 909-645-8864 mobile - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/
Re: please help. everything logged twice
It appears that something else is sending the data to the console also. Posting your whole log4j.properties might help us find the problem. On Nov 14, 2007 9:21 PM, Jim the Standing Bear [EMAIL PROTECTED] wrote: Hi, I have been scratching my head trying to figure out why my application is logging everything twice. Below is the log4j.properties file [code] log4j.logger.com.mydomain.myapp=TRACE, myconsole log4j.appender.myconsole=org.apache.log4j.ConsoleAppender log4j.appender.myconsole.Threshold=TRACE log4j.appender.myconsole.layout=org.apache.log4j.PatternLayout log4j.appender.myconsole.layout.ConversionPattern=%-34d{DATE} [%t] %-5p %c %x -%m%n [/code] But whenever I run it, it would log two lines of everything, one with the time, the next one without [code] 14 Nov 2007 22:09:12,558 [main] INFO com.mydomain.myapp.util.Util -Property CONNECTION_POOL_SIZE = 5 [main] INFO util.Util - Property CONNECTION_POOL_SIZE = 5 14 Nov 2007 22:09:12,558 [main] INFO com.mydomain.myapp.util.Util -Property BROKER_COUNT = 1 [main] INFO util.Util - Property BROKER_COUNT = 1 [/code] However, if I comment out either one of the last two lines in the properties file, i.e. either specifying PatternLayout, or specifying ConversionPattern, but not both, it would print only a single line, however, the date-time stamp will never be present in such cases. And of course, if the line that specified PatternLayout was commented out, it also generated errors. So I dont understand what I did wrong. Please help. Thanks. [code] log4j:ERROR Could not find value for key log4j.appender.myconsole.layout log4j:ERROR No layout set for the appender named [myconsole]. [main] INFO util.Util - Property CONNECTION_POOL_SIZE = 5 [main] INFO util.Util - Property BROKER_COUNT = 1 [/code] -- jim - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/
Re: please help. everything logged twice
Is anything else configuring log4j also? Running with -Dlog4j.debug should help determine that. I would guess that if you changed your console appender to a file appender then the file would have the data that you want and the console would have that data without the dates. On Nov 15, 2007 9:59 AM, Jim the Standing Bear [EMAIL PROTECTED] wrote: Well, here comes the punch line: that WAS the entire log4j.properties file... and that is why I have been scratching my head for the past several days. [code] log4j.logger.com.mydomain.myapp=TRACE, myconsole log4j.appender.myconsole=org.apache.log4j.ConsoleAppender log4j.appender.myconsole.Threshold=TRACE log4j.appender.myconsole.layout=org.apache.log4j.PatternLayout log4j.appender.myconsole.layout.ConversionPattern=%-34d{DATE} [%t] %-5p %c %x -%m%n [/code] On Nov 15, 2007 9:58 AM, James A. N. Stauffer [EMAIL PROTECTED] wrote: It appears that something else is sending the data to the console also. Posting your whole log4j.properties might help us find the problem. On Nov 14, 2007 9:21 PM, Jim the Standing Bear [EMAIL PROTECTED] wrote: Hi, I have been scratching my head trying to figure out why my application is logging everything twice. Below is the log4j.properties file [code] log4j.logger.com.mydomain.myapp=TRACE, myconsole log4j.appender.myconsole=org.apache.log4j.ConsoleAppender log4j.appender.myconsole.Threshold=TRACE log4j.appender.myconsole.layout=org.apache.log4j.PatternLayout log4j.appender.myconsole.layout.ConversionPattern=%-34d{DATE} [%t] %-5p %c %x -%m%n [/code] But whenever I run it, it would log two lines of everything, one with the time, the next one without [code] 14 Nov 2007 22:09:12,558 [main] INFO com.mydomain.myapp.util.Util -Property CONNECTION_POOL_SIZE = 5 [main] INFO util.Util - Property CONNECTION_POOL_SIZE = 5 14 Nov 2007 22:09:12,558 [main] INFO com.mydomain.myapp.util.Util -Property BROKER_COUNT = 1 [main] INFO util.Util - Property BROKER_COUNT = 1 [/code] However, if I comment out either one of the last two lines in the properties file, i.e. either specifying PatternLayout, or specifying ConversionPattern, but not both, it would print only a single line, however, the date-time stamp will never be present in such cases. And of course, if the line that specified PatternLayout was commented out, it also generated errors. So I dont understand what I did wrong. Please help. Thanks. [code] log4j:ERROR Could not find value for key log4j.appender.myconsole.layout log4j:ERROR No layout set for the appender named [myconsole]. [main] INFO util.Util - Property CONNECTION_POOL_SIZE = 5 [main] INFO util.Util - Property BROKER_COUNT = 1 [/code] -- jim - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ -- -- Standing Bear Has Spoken -- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/
Re: How to pick a specific log4j as well its properties file?
Libraries shouldn't include a log4j config file so hopefully few will have that problem. You could use a log4j.xml to prevent the use of any log4j.properties in a lib jar. On Nov 15, 2007 12:57 PM, Jim the Standing Bear [EMAIL PROTECTED] wrote: Hi all, From an earlier problem, I discovered that my application wasn't using the log4j.properties I supplied. In fact, I am not even sure if it was using the log4j from log4j-1.2.13.jar that I supplied. This is because my app also uses cog-jglobus, which contains its own version of log4j. By turning on the debug option, I discovered that the log4j was first looking for XML properties file, which it could not find, then it somehow knew there would be a log4j.properties file packaged in cog-jglobus-1.4.jar, and it used that instead. After I repackaged cog-jglobus by removing the log4j.properties, it started to use the properties file that came with axis2-0.93.jar. So it becomes impractical for me to repackage every single frigging jar that comes with its own log4j.properties. So what is the best way to specify the app to use the log4j from log4j-1.2.13.jar, as well as my own log4j.properties? Currently my code reads a properties file for the application, and one property specifies where logj4.properties is. I would then use that property value to supply PropertyConfigurator.configure() in the constructor of the entry class. It seems that this may not be the best way to do so since log4j automatically read other properties file prior to this one. Thanks. -- Jim - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/
Re: file location - windows vista
With an XML config you can access system properties like ${user.home$ }/logfilename.log On Nov 12, 2007 2:42 PM, epic winter [EMAIL PROTECTED] wrote: I have an application using log4j and in the past I have just specified: log4j.appender.file.File=logfilename.log This would create the file in the location where the java app was launched. This was in C:\program files\MyApp\logfilename.log But windows vista doesn't seem to allow my program to write anywhere in c:\program files. I assume that log file is not being written at all now because of these permissions. Correct? I guess my solution is to write the log file to a folder in the user's home directory. Is there a way to auto specify the user's home directory without hard coding it? thanks -ryan _ Help yourself to FREE treats served up daily at the Messenger Café. Stop by today. http://www.cafemessenger.com/info/info_sweetstuff2.html?ocid=TXT_TAGLM_OctWLtagline -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/
Re: file location - windows vista
That was a typo on my part. It should have been ${user.home }/logfilename.log On Nov 13, 2007 11:47 AM, Curt Arnold [EMAIL PROTECTED] wrote: On Nov 13, 2007, at 9:55 AM, James A. N. Stauffer wrote: With an XML config you can access system properties like ${user.home$ }/logfilename.log I don't think the trailing $ is necessary and would expect that would actually break things, but I'm not sure. System property substitution also works with the property configurator. See the JDK documentation for System.getProperties() (http://java.sun.com/javase/ 6/docs/api/java/lang/System.html#getProperties()) for a list of always available system properties. Using ${java.io.tmpdir} would also be an option. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/
Re: Advantages of using static log methods vs sub classes methods
A wrapper class (if you use something I suggest that you use something that is has been well-tested like commons-logging instead of writing your own) allows you to switch logger implementations but probably prohibits the use of some functionality. I would suggest using a wrapper only if you foresee the need to change logger (i.e. if you are writing a framework and want to leave the logger choice to someone else). On Nov 12, 2007 1:46 PM, Integrator [EMAIL PROTECTED] wrote: Hi , I am comparing the advantages and disadvantages using log4j at its own vs some sub classes (or wrapper classes) with methods for logging messages from application. Which one is better and why ? So far i could understand Utilization of wrapper ensures that you are not tied to specific logging solutions. Is that it or there is something more ? Please express your views and experience on it. Thanks, Integrator -- View this message in context: http://www.nabble.com/Advantages-of-using-static-log-methods-vs-sub-classes-methods-tf4793407.html#a13712766 Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/
Re: LOG4J - Different priority messages to different files
http://logging.apache.org/log4j/1.2/manual.html shows an example for the logger com.foo: *log4j.logger.com.foo=WARN* On 11/5/07, Jimmy Mehta [EMAIL PROTECTED] wrote: Hey James, Thank you so much for your mail...i get your suggestion but i am still not sure how to attach appender to the Job package or user Package or Address Package because i know this thing that we can attach appender to the root category as per example log4j.rootCategory= console. but how should i attach appender to individual package. Can you please give me sample code ,it will be appreciated and clear my self. Jimmy James A. N. Stauffer wrote: You shouldn't need to use incorrect levels in your classes. Just attach one appender to the Job logger and another appender to the Address and User loggers. On 11/1/07, Jimmy Mehta [EMAIL PROTECTED] wrote: Hey James , Thanks for you reply now i find another way that , i have three classes Job , Address , User. Now i want to put All messages of Job class into separate file and all Address messages to another file and same as in User. So if i set priority level in Job class like warn so all fatal , error and warn messages of Job class goes to one file and no any other class messages so how can i do it with Properties file?? Can you give me one sample code example so i can understand more clearly.. Appreciate ur help Jimmy Mehta James A. N. Stauffer wrote: I find that I want one file for each level and higher. i.e. Warn.loghas warn, error, and fatal messages. That can easily be done by setting thresholds on each appender. If you want only a certain level then you can use a level match filter but that requires XML config. On 10/31/07, Jimmy Mehta [EMAIL PROTECTED] wrote: Hi, I am new to the LOG4J and i am trying to learn so i have a question that if i need to put different priority log messages to different log files. Suppose i want to put all warn messages to one file and all info messages to another file and all error messages to another file. My root priority is Info and I also set different packages to different priority level. Suppose com.tc.portal.xyz = info so how should i put different priority messages to different file Main thing , i want to make only change in log4j.properties file , i don't want to change java files Jimmy -- View this message in context: http://www.nabble.com/LOG4J---Different-priority-messages-to-different-files-tf4728211.html#a13519537 Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ -- View this message in context: http://www.nabble.com/LOG4J---Different-priority-messages-to-different-files-tf4728211.html#a13535224 Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ -- View this message in context: http://www.nabble.com/LOG4J---Different-priority-messages-to-different-files-tf4728211.html#a13592319 Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/
Re: LOG4J - Different priority messages to different files
I don't use a properties config file but that looks correct to me. On 11/5/07, Jimmy Mehta [EMAIL PROTECTED] wrote: Hey James, Thank you so much and i appreciate your help , i ma playing with log4j.properties file i didnt touch JAVA file but now i am able to get job messages to diffrent file and org to different file but now i a facing problem is that i am not able to set priority properly ,if i am setting priority on JOB folder = warn but it display info messages also so i am not able to get only messages that has high priority then warn, this is my code # Two appenders , one for file and one for Console log4j.rootCategory=warn , dest1 , console log4j.logger.Job = warn , FileAppenderForJob log4j.logger.User = error , FileAppenderForUser log4j.logger.Organization = info , FileAppenderForOrganization # First Appender writes to the console log4j.appender.console = org.apache.log4j.ConsoleAppender log4j.appender.console.layout = org.apache.log4j.PatternLayout # to display file name and line number log4j.appender.console.layout.ConversionPattern = %5p [%t] (%F:%L) - %m%n #Second Appender writes to the File log4j.appender.dest1 = org.apache.log4j.RollingFileAppender log4j.appender.dest1.File = example.log log4j.appender.dest1.MaxFileSize = 100KB log4j.appender.dest1.MaxBackupIndex = 1 log4j.appender.dest1.layout = org.apache.log4j.PatternLayout log4j.appender.dest1.layout.ConversionPattern= %d %p [%t] (%c) - %m%n #Appender writes to the JobFile log4j.appender.FileAppenderForJob = org.apache.log4j.RollingFileAppender log4j.appender.FileAppenderForJob.File = Job.log log4j.appender.FileAppenderForJob.MaxFileSize = 100KB log4j.appender.FileAppenderForJob.MaxBackupIndex = 1 log4j.appender.FileAppenderForJob.layout = org.apache.log4j.PatternLayout log4j.appender.FileAppenderForJob.layout.ConversionPattern= %d %p [%t] (%c) - %m%n #Appender writes to the UserFile log4j.appender.FileAppenderForUser = org.apache.log4j.RollingFileAppender log4j.appender.FileAppenderForUser.File = User.log log4j.appender.FileAppenderForUser.MaxFileSize = 100KB log4j.appender.FileAppenderForUser.MaxBackupIndex = 1 log4j.appender.FileAppenderForUser.layout = org.apache.log4j.PatternLayout log4j.appender.FileAppenderForUser.layout.ConversionPattern= %d %p [%t] (%c) - %m%n #Appender writes to the OrganizationFile log4j.appender.FileAppenderForOrganization = org.apache.log4j.RollingFileAppender log4j.appender.FileAppenderForOrganization.File = Organization.log log4j.appender.FileAppenderForOrganization.MaxFileSize = 100KB log4j.appender.FileAppenderForOrganization.MaxBackupIndex = 1 log4j.appender.FileAppenderForOrganization.layout = org.apache.log4j.PatternLayout log4j.appender.FileAppenderForOrganization.layout.ConversionPattern= %d %p [%t] (%c) - %m%n So can you please se and tell me whats the problem? Jimmy James A. N. Stauffer wrote: http://logging.apache.org/log4j/1.2/manual.html shows an example for the logger com.foo: *log4j.logger.com.foo=WARN* On 11/5/07, Jimmy Mehta [EMAIL PROTECTED] wrote: Hey James, Thank you so much for your mail...i get your suggestion but i am still not sure how to attach appender to the Job package or user Package or Address Package because i know this thing that we can attach appender to the root category as per example log4j.rootCategory= console. but how should i attach appender to individual package. Can you please give me sample code ,it will be appreciated and clear my self. Jimmy James A. N. Stauffer wrote: You shouldn't need to use incorrect levels in your classes. Just attach one appender to the Job logger and another appender to the Address and User loggers. On 11/1/07, Jimmy Mehta [EMAIL PROTECTED] wrote: Hey James , Thanks for you reply now i find another way that , i have three classes Job , Address , User. Now i want to put All messages of Job class into separate file and all Address messages to another file and same as in User. So if i set priority level in Job class like warn so all fatal , error and warn messages of Job class goes to one file and no any other class messages so how can i do it with Properties file?? Can you give me one sample code example so i can understand more clearly.. Appreciate ur help Jimmy Mehta James A. N. Stauffer wrote: I find that I want one file for each level and higher. i.e. Warn.loghas warn, error, and fatal messages. That can easily be done by setting thresholds on each appender. If you want only a certain level then you can use a level match filter but that requires XML config. On 10/31/07, Jimmy Mehta [EMAIL PROTECTED] wrote: Hi, I am new to the LOG4J and i am trying to learn so i have a question that if i need to put different priority log messages to different log
Re: FileAppender location question
The relative path should be from the running working directory so change the working directory for each program. On 11/2/07, mbraunwart [EMAIL PROTECTED] wrote: When I started a couple tutorials for Log4J in eclipse, it would store the file inside of the folder i specified in the root of the project folder without having to give it a full path. This current project that I am working with, taking pretty much the same xml and idea from the tutorials, I am having a problem to where it wants to store my logs in the eclipse program folder, as opposed to the project root folder. I have 3 projects set up, one really has nothing to do with the other 2, the main project where i am gathering my logs is a controller core, and the front end is another project that is a j2ee interface which uses the jar from the core project. Right now I have to feed it an exact path name to where I want the logs stored, I'd like to figure out the best way to have it store in a logs/activity.log from the root of the core project. I've tried searching for answers to this but I seem to not either be using the right search criteria, or the answer is out there or I'm overlooking it. I have a feeling it might be a simple answer and I'm overlooking it, but any help would be greatly appreciated. Thank you -- View this message in context: http://www.nabble.com/FileAppender-location-question-tf4738706.html#a13551552 Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/
Re: FileAppender location question
Eclipse should let you set the working directory for when you run the program. I don't use it so I don't know exactly how to do it. On 11/2/07, mbraunwart [EMAIL PROTECTED] wrote: I'm sorry, I don't know where I can set this at in the application, or maybe I might not have been clear. The problem that seems to be the case is that, I imported the project into eclipse, but not in my workspace, it stores the logs, without a definite path set, to where eclipse is running from, i.e. C:\eclipse, even though that is not my workspace. So I'm not sure where I need to fix this. James A. N. Stauffer wrote: The relative path should be from the running working directory so change the working directory for each program. On 11/2/07, mbraunwart [EMAIL PROTECTED] wrote: When I started a couple tutorials for Log4J in eclipse, it would store the file inside of the folder i specified in the root of the project folder without having to give it a full path. This current project that I am working with, taking pretty much the same xml and idea from the tutorials, I am having a problem to where it wants to store my logs in the eclipse program folder, as opposed to the project root folder. I have 3 projects set up, one really has nothing to do with the other 2, the main project where i am gathering my logs is a controller core, and the front end is another project that is a j2ee interface which uses the jar from the core project. Right now I have to feed it an exact path name to where I want the logs stored, I'd like to figure out the best way to have it store in a logs/activity.log from the root of the core project. I've tried searching for answers to this but I seem to not either be using the right search criteria, or the answer is out there or I'm overlooking it. I have a feeling it might be a simple answer and I'm overlooking it, but any help would be greatly appreciated. Thank you -- View this message in context: http://www.nabble.com/FileAppender-location-question-tf4738706.html#a13551552 Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ -- View this message in context: http://www.nabble.com/FileAppender-location-question-tf4738706.html#a13554219 Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/
Re: LOG4J - Different priority messages to different files
You shouldn't need to use incorrect levels in your classes. Just attach one appender to the Job logger and another appender to the Address and User loggers. On 11/1/07, Jimmy Mehta [EMAIL PROTECTED] wrote: Hey James , Thanks for you reply now i find another way that , i have three classes Job , Address , User. Now i want to put All messages of Job class into separate file and all Address messages to another file and same as in User. So if i set priority level in Job class like warn so all fatal , error and warn messages of Job class goes to one file and no any other class messages so how can i do it with Properties file?? Can you give me one sample code example so i can understand more clearly.. Appreciate ur help Jimmy Mehta James A. N. Stauffer wrote: I find that I want one file for each level and higher. i.e. Warn.loghas warn, error, and fatal messages. That can easily be done by setting thresholds on each appender. If you want only a certain level then you can use a level match filter but that requires XML config. On 10/31/07, Jimmy Mehta [EMAIL PROTECTED] wrote: Hi, I am new to the LOG4J and i am trying to learn so i have a question that if i need to put different priority log messages to different log files. Suppose i want to put all warn messages to one file and all info messages to another file and all error messages to another file. My root priority is Info and I also set different packages to different priority level. Suppose com.tc.portal.xyz = info so how should i put different priority messages to different file Main thing , i want to make only change in log4j.properties file , i don't want to change java files Jimmy -- View this message in context: http://www.nabble.com/LOG4J---Different-priority-messages-to-different-files-tf4728211.html#a13519537 Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ -- View this message in context: http://www.nabble.com/LOG4J---Different-priority-messages-to-different-files-tf4728211.html#a13535224 Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/
Re: Doubt
Per the javadocs there is not a conversion pattern for HTML layout. http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/HTMLLayout.html On 10/31/07, ratnesh gupta [EMAIL PROTECTED] wrote: Hi *.*, Is there a way to specify in the configuration file a ConversionPattern for HTMLLayout? If I use this, log4j.appender.file=org.apache.log4j.FileAppender log4j.appender.file.File=log4j.html log4j.priority.file=DEBUG log4j.appender.file.layout=org.apache.log4j.HTMLLayout log4j.appender.file.layout.ConversionPattern=%-5p %c - %m%n It throws, log4j:WARN No such property [conversionPattern] in org.apache.log4j.HTMLLayout. Is there any work around to this? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/
Re: LOG4J - Different priority messages to different files
I find that I want one file for each level and higher. i.e. Warn.log has warn, error, and fatal messages. That can easily be done by setting thresholds on each appender. If you want only a certain level then you can use a level match filter but that requires XML config. On 10/31/07, Jimmy Mehta [EMAIL PROTECTED] wrote: Hi, I am new to the LOG4J and i am trying to learn so i have a question that if i need to put different priority log messages to different log files. Suppose i want to put all warn messages to one file and all info messages to another file and all error messages to another file. My root priority is Info and I also set different packages to different priority level. Suppose com.tc.portal.xyz = info so how should i put different priority messages to different file Main thing , i want to make only change in log4j.properties file , i don't want to change java files Jimmy -- View this message in context: http://www.nabble.com/LOG4J---Different-priority-messages-to-different-files-tf4728211.html#a13519537 Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/
Re: Alternative Logger naming strategies?
Some people prepend a catagory to the logger name (i.e. security.com.package.class). On 10/30/07, Paul Duffy [EMAIL PROTECTED] wrote: Hi, Wrestling with some product requirements. My app will be deployed to a JEE container, which is using the typical class based Logger naming convention. The beans deployed to the container need finer grained control of the logging event generation. Compile time setting of DEBUG, WARN, INFO, etc. level is not adequate. There is a desire to provide explicit, individual on/off control of all logging events. Wondering what common Logger naming strategies are used (versus class based naming). Cheers - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/
Re: log4j does not display thread number in Sun App. Server 8
%t probably calls Thread.toString() so it wouldn't have any impact on the thread number being included. It should still include the thread name. On 10/24/07, anurak [EMAIL PROTECTED] wrote: hi, I already used %t, but thread number does not display in log file. Any help please. thanks in advance, anurak -- View this message in context: http://www.nabble.com/log4j-does-not-display-thread-number-in-Sun-App.-Server-8-tf4688472.html#a13399827 Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: log4j file name and line number
If you wrap calls to log4j, you need to make a special call so it will get that info correctly. I don't know off hand what that call is. On 10/25/07, orko [EMAIL PROTECTED] wrote: Hi every one, I am trying to replace my current logging system into log4j. There is a logging object (logging.java) which acts as a layer between logging system and my application, so that other developers don't have to worry about this change. So when a log method (debug, or trace) is called, it gets initialized from this layer. I have been trying to understand how the file name and line number (%f, %l) works. I can see the pattern in appender objects. But can't find how these (filename and linenumber) are getting initialized. It always gives me logging.java as file name instead of the file name where it was first called. Does any one have any idea how it is really working? -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Getting log4j.properties out of WEB-INF/classes
Options (roughly decreasing recommendations): 1. Move to a share location like tomcat/common/classes 2. Set a system property to give the path to log4j.properties (I forgot the name) 3. Explicitly call configure. On 10/24/07, Troy Davis [EMAIL PROTECTED] wrote: Hello, I've been trying to get log4j to load my properties file from somewhere other than WEB-INF/classes, mostly because eclipse clears out this directory when I choose Project - Clean. I've tried a few different approaches that I found online, including this: (inside web-app block of web.xml): servlet servlet-namelog4j-init/servlet-name servlet-classcom.m4.Log4jInit/servlet-class init-param param-namelog4j-init-file/param-name param-valueWEB-INF/log4j.properties/param-value /init-param load-on-startup1/load-on-startup /servlet (full text of Log4jInit.java, compiled and included in a jar in WEB- INF/lib): package com.m4; import org.apache.log4j.PropertyConfigurator; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.PrintWriter; import java.io.IOException; public class Log4jInit extends HttpServlet { private static final long serialVersionUID = -5104057715092254401L; public void init() { String prefix = getServletContext().getRealPath(/); String file = getInitParameter(log4j-init-file); System.out.println(Initializing log4j with + prefix + file); // if the log4j-init-file is not set, then no point in trying if(file != null) { PropertyConfigurator.configure(prefix+file); } } public void doGet(HttpServletRequest req, HttpServletResponse res) { // Nothing happening here yet. } } I can see the debug line go by when init() is called in Log4jInit, but I still get an error saying that log4j is not configured properly. What is the recommended way to load this file from some other location? Thank You, Troy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Suppressing passwords in the log files?
You could use a filter to surpress the message any message that has password in it. On 10/15/07, John Smith [EMAIL PROTECTED] wrote: Hi, Is there any way to suppress passwords' display in the log files? I am concerned that log files will be accessible to various users on the server, disclosing the application passwords to them. Is there some way to filter the passwords before they are committed to the log file? Thanks, John (2007-10-12 02:02:23,451) 1140750 [ajp-0.0.0.0-8100-14] DEBUG org.apache.jasper.servlet.JspServlet:259 -password = TESTPASSWORD (2007-10-12 02:02:23,452) 1140751 [ajp-0.0.0.0-8100-14] DEBUG org.apache.jasper.servlet.JspServlet:259 -Submit = Go (2007-10-12 02:02:23,452) 1140751 [ajp-0.0.0.0-8100-14] DEBUG org.apache.jasper.servlet.JspServlet:259 -redirectURL = (2007-10-12 02:02:23,453) 1140752 [ajp-0.0.0.0-8100-14] DEBUG org.apache.jasper.servlet.JspServlet:259 -username = TESTUSERNAME (2007-10-12 02:02:23,455) 1140754 [ajp-0.0.0.0-8100-14] DEBUG org.apache.catalina.core.ApplicationDispatcher:185 - servletPath=/auth/loginMessage.jsp, pathInfo=null, queryString=null, name=null (2007-10-12 02:02:23,456) 1140755 [ajp-0.0.0.0-8100-14] DEBUG org.apache.catalina.core.ApplicationDispatcher:562 - Path Based Include (2007-10-12 02:02:23,457) 1140756 [ajp-0.0.0.0-8100-14] DEBUG org.apache.jasper.servlet.JspServlet:249 - JspEngine -- /auth/loginMessage.jsp (2007-10-12 02:02:23,458) 1140757 [ajp-0.0.0.0-8100-14] DEBUG org.apache.jasper.servlet.JspServlet:250 -ServletPath: /auth/loginWarning.jsp (2007-10-12 02:02:23,458) 1140757 [ajp-0.0.0.0-8100-14] DEBUG org.apache.jasper.servlet.JspServlet:251 - PathInfo: null (2007-10-12 02:02:23,459) 1140758 [ajp-0.0.0.0-8100-14] DEBUG org.apache.jasper.servlet.JspServlet:252 - RealPath: /opt/jboss-4.2.0.GA/server/storeapp/./deploy/jboss-storeapp.ear/jboss-storeapp.war/auth/loginMessage.jsp (2007-10-12 02:02:23,460) 1140759 [ajp-0.0.0.0-8100-14] DEBUG org.apache.jasper.servlet.JspServlet:253 - RequestURI: /admin/auth/loginWarning.jsp (2007-10-12 02:02:23,461) 1140760 [ajp-0.0.0.0-8100-14] DEBUG org.apache.jasper.servlet.JspServlet:254 -QueryString: null (2007-10-12 02:02:23,461) 1140760 [ajp-0.0.0.0-8100-14] DEBUG org.apache.jasper.servlet.JspServlet:255 - Request Params: (2007-10-12 02:02:23,462) 1140761 [ajp-0.0.0.0-8100-14] DEBUG org.apache.jasper.servlet.JspServlet:259 -password = TESTPASSWORD - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Create multiple appenders objects
When creating appenders programatically you need to do something like calling activateOptions(). You will probably find that using a config file works much better. On 10/11/07, Julio S. G. [EMAIL PROTECTED] wrote: Hi, I'm trying to create several appenders and unfortunately it's not working. To create the objects I'm using something like new DailyRollingFileAppender() with corrects parameters. Then I create the Logger using the appender name. Finally, when I use the Logger object to write, it doesn't work. I'll put the code here and if anyone could help me I really appreciate. Layout layout1 = new PatternLayout(%m%n); Layout layout2 = new PatternLayout(%m%n); DailyRollingFileAppender app1 = new DailyRollingFileAppender(layout1, /file1.log, '.'MMddHH); DailyRollingFileAppender app2 = new DailyRollingFileAppender(layout2, /file2.log, '.'MMddHH); app1.setThreshold(Level.DEBUG); app2.setThreshold(Level.DEBUG); app1.setName(APPENDER1); app2.setName(APPENDER2); Logger logger1 = Logger.getLogger(app1.getName()); Logger logger2 = Logger.getLogger(app2.getName()); logger1.info(TEST 1!!!); logger2.info(TEST 2!!!); Thanks, Julio - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Location of Log4J file in web application
If you set a system property it can be used in your log4j.xml. param name=File value=${log4jXmlFilter}/ You your machine run java with -Dlog4jXmlFilter=C:/Documents and Settings/Kulkara/My Documents/ashish/code/workspace5.1M/version6300build12-00/log4jXmlFilter.log On 10/4/07, Ashish Kulkarni [EMAIL PROTECTED] wrote: Hi How do we set the log file location dyanamically in web application, Currently i am using log4j.xml file with following definiation, this file is under WEB-INF file appender name=A2 class= org.apache.log4j.DailyRollingFileAppender param name=File value=C:\\Documents and Settings\\Kulkara\\My Documents\\ashish\\code\\workspace5.1M\\version6300build12-00\\log4jXmlFilter.log / ... /appender and in load the this xml file in Servlet using String fileName = config.getInitParameter(log4j.xml); ServletContext oCtx = config.getServletContext(); URL path = oCtx.getResource (fileName); DOMConfigurator.configure(path); But if i have to install this on unix, i have to change the path, also the server on which i will install this may not have the folder, so i will have to recreate a war file So is there a dynamic way of telling log4j the location and name of log file? which can work on any system. i would prefer the log file to be under the same folder application is installed Ashish -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Location of Log4J file in web application
I use Tomcat and I can set system properties. I would be very surprise if you can't set system properties on WebLogic. This might not work if you aren't given the rights to set system properties. On 10/4/07, Ashish Kulkarni [EMAIL PROTECTED] wrote: Hi But will this work in web application also, for example i am installing software on web logic, or websphere, will this work Ashis On 10/4/07, James A. N. Stauffer [EMAIL PROTECTED] wrote: If you set a system property it can be used in your log4j.xml. param name=File value=${log4jXmlFilter}/ You your machine run java with -Dlog4jXmlFilter=C:/Documents and Settings/Kulkara/My Documents/ashish/code/workspace5.1M/version6300build12-00/log4jXmlFilter.log On 10/4/07, Ashish Kulkarni [EMAIL PROTECTED] wrote: Hi How do we set the log file location dyanamically in web application, Currently i am using log4j.xml file with following definiation, this file is under WEB-INF file appender name=A2 class= org.apache.log4j.DailyRollingFileAppender param name=File value=C:\\Documents and Settings\\Kulkara\\My Documents\\ashish\\code\\workspace5.1M\\version6300build12-00\\log4jXmlFilter.log / ... /appender and in load the this xml file in Servlet using String fileName = config.getInitParameter(log4j.xml); ServletContext oCtx = config.getServletContext(); URL path = oCtx.getResource (fileName); DOMConfigurator.configure(path); But if i have to install this on unix, i have to change the path, also the server on which i will install this may not have the folder, so i will have to recreate a war file So is there a dynamic way of telling log4j the location and name of log file? which can work on any system. i would prefer the log file to be under the same folder application is installed Ashish -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Log4j deadlock
Does this provide any clues? Do you have suggestions on what I should do? Java stack information for the threads listed above: === ConnectorThread jdbc:weblogic:mssqlserver4:[EMAIL PROTECTED]:1433: at org.apache.log4j.Category.callAppenders(Category.java:185) - waiting to lock 0xa63067d0 (a org.apache.log4j.spi.RootCategory) at org.apache.log4j.Category.forcedLog(Category.java:372) at org.apache.log4j.Category.info(Category.java:674) at sps.webec.sql.ConnectionBroker.connect(ConnectionBroker.java:260) at sps.webec.sql.ConnectionBroker.createFree(ConnectionBroker.java:232) - locked 0xa6305750 (a sps.webec.sql.ConnectionBroker) at sps.webec.sql.ConnectionBroker.access$200(ConnectionBroker.java:23) at sps.webec.sql.ConnectionBroker$ConnectorThread.run(ConnectionBroker.java:346) main: at sps.webec.sql.ConnectionBroker.getConnectionAttributes(ConnectionBroker.java:62) - waiting to lock 0xa6305750 (a sps.webec.sql.ConnectionBroker) at sps.webec.sql.DatabaseManager.getConnectionAttributes(DatabaseManager.java:490) at sps.webec.sql.DatabaseManager.executeInsert(DatabaseManager.java:227) at sps.webec.sql.DatabaseManager.execute(DatabaseManager.java:64) at sps.webec.server.util.DBAppender.append(DBAppender.java:65) at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:221) - locked 0xa618b640 (a sps.webec.server.util.DBAppender) at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:57) at org.apache.log4j.Category.callAppenders(Category.java:187) - locked 0xa63067d0 (a org.apache.log4j.spi.RootCategory) at org.apache.log4j.Category.forcedLog(Category.java:372) at org.apache.log4j.Category.error(Category.java:303) at sps.webec.server.util.Log.LogException(Log.java:124) at sps.webec.engine.Logger.logException(Logger.java:155) at sps.webec.engine.FEDSException.logException(FEDSException.java:197) at sps.webec.engine.Engine.createExceptionLog(Engine.java:637) at sps.webec.engine.Engine.handleFEDSException(Engine.java:679) at sps.webec.engine.Engine.receive(Engine.java:990) at sps.webec.engine.Engine.processReceive(Engine.java:409) at sps.webec.engine.Engine.processArguments(Engine.java:247) at sps.webec.engine.Engine.start(Engine.java:143) at sps.webec.engine.Engine.main(Engine.java:76) On 9/21/07, Curt Arnold [EMAIL PROTECTED] wrote: On Sep 21, 2007, at 3:18 PM, James A. N. Stauffer wrote: We don't redirect System.out or System.err. Both stack traces showed that both threads were calling logger.debug or logger.info. Calling stacks would be very helpful to try to analyze the problem. The most obvious way to get a deadlock where one of the monitors is RootLogger or RootCategory would be when a log request is made (possibly indirectly) in the course of processing a log request. On Sep 21, 2007, at 10:18 AM, James A. N. Stauffer wrote: After years of using log4j I also encountered this. Is it a freak, rare occurance or is there a cause that can be addressed? Finer grain and provably safe concurrency is the primary design objective for log4j 2.0 and can not be achieved without significant implementation and API changes (hence why it has to be part of log4j 2.0 and not a 1.x). The internals of log4j 1.x are not thread-safe but depend on coarse-grained locks to prevent more than more one log request to be processed at a time. The coarse grained locks significantly impact performance on multi-core machines and leave the potential for these types of deadlocks. Individual problems can be analyzed and fixed or worked around, but eliminating all potential problems requires a near complete rework. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Log4j deadlock
Would reducing the number of logs that get to the appender reduce the chance for this? What else could be done to reduce the chance of it happening? On 9/21/07, Curt Arnold [EMAIL PROTECTED] wrote: The most obvious way to get a deadlock where one of the monitors is RootLogger or RootCategory would be when a log request is made (possibly indirectly) in the course of processing a log request. -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Log4j deadlock
The two threads use different loggers. If I made the sub-logger point to the same appender with additivity=false would that prevent the problem. It appears that Catagory.callAppenders locks each catagory up the chain so setting additivity to false should prevent the two threads from locking the same Catagory objects. Is that correct? BTW, I am using 1.2.8. On 9/24/07, James A. N. Stauffer [EMAIL PROTECTED] wrote: Would reducing the number of logs that get to the appender reduce the chance for this? What else could be done to reduce the chance of it happening? On 9/21/07, Curt Arnold [EMAIL PROTECTED] wrote: The most obvious way to get a deadlock where one of the monitors is RootLogger or RootCategory would be when a log request is made (possibly indirectly) in the course of processing a log request. -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Log4j deadlock
I used to have additivity set to false for sps.webec.sql (I don't know why it was changed). Would that be sufficient to fix it? On 9/24/07, Curt Arnold [EMAIL PROTECTED] wrote: On Sep 24, 2007, at 8:59 AM, James A. N. Stauffer wrote: Does this provide any clues? Yes, the problem is shown in the stack trace. sps.webec.sql.ConnectionBroker uses log4j internally and is also used to implement an log4j appender. The problem comes that the order of obtaining locks is inconsistent. In the first thread it is: synchronized(ConnectionBroker) { synchronized(RootCategory) { append message; } } In the other thread it is: synchronized(RootCategory) { start DB appending synchronized(ConnectionBroker) { finish DB appending; } } The deadlock occurs when each thread gets its first lock, but can't get its second. Do you have suggestions on what I should do? If you are just using the sps.webec packages and have no ability to change the code, you could work around the problem by configuration changes so that the sps.webec.sql.ConnectionBroker logging requests aren't sent to a sps.webec.server.util.DBAppender (at least directly). If you know the logger names used in that code, you could set the threshold to OFF, you could direct the logging requests to a different type of appender (console or file). You could also wrap the sps.webec.server.util.DBAppender with an AsyncAppender with blocking = false. If you do have ability to change the code, then you could look at the possibility of moving the logging code in ConnectionBroker so that logging occurs after the ConnectionBroker lock is released. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Log4j deadlock
After years of using log4j I also encountered this. Is it a freak, rare occurance or is there a cause that can be addressed? Found one Java-level deadlock: = ConnectorThread jdbc:weblogic:mssqlserver4:[EMAIL PROTECTED]:1433: waiting to lock monitor 0x000e00d8 (object 0xa63067d0, a org.apache.log4j.spi.RootCategory), which is held by main main: waiting to lock monitor 0x000e0120 (object 0xa6305750, a sps.webec.sql.ConnectionBroker), which is held by ConnectorThread jdbc:weblogic:mssqlserver4:[EMAIL PROTECTED]:1433 On 5/25/06, Iyer, Vidya [EMAIL PROTECTED] wrote: Hi, I'm running an application with several threads, and at the end of the program, each thread logs an info statement that it is shutting down. Unfortunately, I periodically see two threads get deadlocked with the below error. The docs say that log4j is supposed to be thread safe, but it looks like there might be a bug in the synchronized code. Has anyone experienced this before? Found one Java-level deadlock: = MessageReader-15: waiting to lock monitor 0x0809f394 (object 0x666b4788, a java.io.PrintStream), which is held by main main: waiting to lock monitor 0x0809f494 (object 0x65e061a0, a org.apache.log4j.spi.RootLogger), which is held by MessageReader-15 Thanks, Vidya -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Log4j deadlock
We don't redirect System.out or System.err. Both stack traces showed that both threads were calling logger.debug or logger.info. On 9/21/07, Curt Arnold [EMAIL PROTECTED] wrote: Took me a while to notice that the quoted post is over a year old. I didn't see any follow up in the archives. In the original posting, that it is a block between a lock on a PrintStream and a RootLogger suggest to me that System.out might have been redirected to log4j and when log4j attempted to write to LogLog, it blocked. But that is just a guess, however anything that redirects System.out or .err to log4j would be likely to encounter deadlocks. On Sep 21, 2007, at 10:18 AM, James A. N. Stauffer wrote: After years of using log4j I also encountered this. Is it a freak, rare occurance or is there a cause that can be addressed? Found one Java-level deadlock: = ConnectorThread jdbc:weblogic:mssqlserver4:[EMAIL PROTECTED]:1433: waiting to lock monitor 0x000e00d8 (object 0xa63067d0, a org.apache.log4j.spi.RootCategory), which is held by main main: waiting to lock monitor 0x000e0120 (object 0xa6305750, a sps.webec.sql.ConnectionBroker), which is held by ConnectorThread jdbc:weblogic:mssqlserver4:[EMAIL PROTECTED]:1433 On 5/25/06, Iyer, Vidya [EMAIL PROTECTED] wrote: Hi, I'm running an application with several threads, and at the end of the program, each thread logs an info statement that it is shutting down. Unfortunately, I periodically see two threads get deadlocked with the below error. The docs say that log4j is supposed to be thread safe, but it looks like there might be a bug in the synchronized code. Has anyone experienced this before? Found one Java-level deadlock: = MessageReader-15: waiting to lock monitor 0x0809f394 (object 0x666b4788, a java.io.PrintStream), which is held by main main: waiting to lock monitor 0x0809f494 (object 0x65e061a0, a org.apache.log4j.spi.RootLogger), which is held by MessageReader-15 Thanks, Vidya -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Pretty Layout of logging by class method
You might be able to push a space character with NDC (and pop it when you exit). Then print the NDC as the first part of the message. On 8/31/07, Faine, Mark R. (MSFC-NNM04AA02C)[SAIC] [EMAIL PROTECTED] wrote: I'd like for Log4J to print the log messages with some sort of indentation, preferably by Class and Method Something like: Start Class1 Inside Main method... Calling Sub method... Inside Sub method... Executing operations in sub method... Sub Method success Main Method success End Class1 Start Class2 ... End Class2 Is this currently possible? Thanks, -Mark - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Appenders writing log file when not called apon
Log4j does creates files for every appender when initialized. You could write your own appender to change that. On 8/29/07, Niraj Patel [EMAIL PROTECTED] wrote: I have a log4j.xml file which is used by dozens of classes throughout the day. One of these classes needs to log some data into a separate file, so I created the following config: appender name=XXX class=org.apache.log4j.DailyRollingFileAppender param name=File value=../logs/XXX.log/ param name=Append value=true/ param name=DatePattern value='.'-MM-dd / /appender category name=a.b.c.XXXClass appender-ref ref=XXX / /category Although the XXX.log file is written to disk (albeit empty) every time the log4j engine is initialised by the other classes. Am I correct in saying that the Log4J engine will parse all appenders and write any log files not on disk, to disk? Is there a way to stop this? I only want the log file to be written onto disk when XXXClass logs data. Cheers in advance, Niraj -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Appenders writing log file when not called apon
I would like the FileAppender to only create the file when about to write the first log. On 8/29/07, Niraj Patel [EMAIL PROTECTED] wrote: Cheers for the confirmation. I would rather fix this with via the properties file, but if that aint possible then a code fix will have to do. Anyone lese think this feature is something that should be overideable with a parameter or something? Niraj On 8/29/07, James A. N. Stauffer [EMAIL PROTECTED] wrote: Log4j does creates files for every appender when initialized. You could write your own appender to change that. On 8/29/07, Niraj Patel [EMAIL PROTECTED] wrote: I have a log4j.xml file which is used by dozens of classes throughout the day. One of these classes needs to log some data into a separate file, so I created the following config: appender name=XXX class=org.apache.log4j.DailyRollingFileAppender param name=File value=../logs/XXX.log/ param name=Append value=true/ param name=DatePattern value='.'-MM-dd / /appender category name=a.b.c.XXXClass appender-ref ref=XXX / /category Although the XXX.log file is written to disk (albeit empty) every time the log4j engine is initialised by the other classes. Am I correct in saying that the Log4J engine will parse all appenders and write any log files not on disk, to disk? Is there a way to stop this? I only want the log file to be written onto disk when XXXClass logs data. Cheers in advance, Niraj -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: AsyncAppender
What version of log4j are you using? There were problems with that appender in older versions. On 8/28/07, Dmitry Beransky [EMAIL PROTECTED] wrote: Hi, Are there any tricks to using the asyncronous appender class? I've added the following to my log4j.xml file: appender name=A_FILE class=org.apache.log4j.AsyncAppender appender-ref ref=FILE/ /appender and as soon as I switch the root from FILE to A_FILE, logging stops. The file is still being created though by the nested appender. Dmitry -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Question about logging to multiple files
You probably don't want to put the A2 appender in the root section. Also if you set additivity=false in the com.test.me.my.Test catagory/logger then the message won't go to the A1 appender. On 8/23/07, Ashish Kulkarni [EMAIL PROTECTED] wrote: Hi I am using XML to define my logging properties, I wanted to know if i can define 2 log files, and have logs in them depending on which class is writing log file for example if the package is com.test.me then the logs should be written to mylog.xml file if the class is com.test.me.my.Test then the logs should be written to mytest.log file. Here is my XML file appender name=A1 class=org.apache.log4j.DailyRollingFileAppender param name=File value=C:\\mylog.xml / param name=DatePattern value='.'-MM-dd / layout class=org.apache.log4j.xml.XMLLayout /layout /appender appender name=A2 class=org.apache.log4j.DailyRollingFileAppender param name=File value=c:\\ mytest.log / param name=DatePattern value='.'-MM-dd / layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%d %-5p [%t] %C{2} (%F:%L) - %m%n / /layout /appender category name=com.test.me priority value=debug / appender-ref ref=A1 / /category category name=com.test.me.my.Test priority value=debug / appender-ref ref=A2 / /category root appender-ref ref=A1 / appender-ref ref=A2 / /root -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Question about logging to multiple files
You still need to set additivity. I *think* it is: log4j.additivity.com.test.me.my.Test=false Also I think you may be defining you loggers incorrectly but I'm not sure. On 8/23/07, Ashish Kulkarni [EMAIL PROTECTED] wrote: Hi This works fine, can i do the same if i am using properties file instead of XML file for defining configuration some thing like log4j.rootLogger= A1 log4j.appender.A1=org.apache.log4j.ConsoleAppender # A1 uses PatternLayout. log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=%d %-5p [%t] %-17c{2} (%13F:%L) %3x - %m%n log4j.appender.A1.com.test.me=DEBUG log4j.appender.A2=org.apache.log4j.DailyRollingFileAppender log4j.appender.A2.File=${java.io.tmpdir}approvals6000F3.txt log4j.appender.A2.Append=false log4j.appender.A2.DatePattern='.'-MM-dd log4j.appender.A2.layout=org.apache.log4j.PatternLayout log4j.appender.A2.layout.ConversionPattern=%-5r %-5p [%t] %c{2} - %m%n log4j.appender.A2.com.test.me.my.Test=DEBUG The way i have written in above properties file, will it work as expected? Ashish On 8/23/07, Curt Arnold [EMAIL PROTECTED] wrote: On Aug 23, 2007, at 3:24 PM, Ashish Kulkarni wrote: Hi I am using XML to define my logging properties, I wanted to know if i can define 2 log files, and have logs in them depending on which class is writing log file for example if the package is com.test.me then the logs should be written to mylog.xml file if the class is com.test.me.my.Test then the logs should be written to mytest.log file. Here is my XML file + log4j:configuration threshold=debug appender name=A1 class=org.apache.log4j.DailyRollingFileAppender param name=File value=C:\\mylog.xml / param name=DatePattern value='.'-MM-dd / layout class=org.apache.log4j.xml.XMLLayout /layout /appender appender name=A2 class=org.apache.log4j.DailyRollingFileAppender param name=File value=c:\\ mytest.log / param name=DatePattern value='.'-MM-dd / layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%d %-5p [%t] %C{2} (%F:%L) - %m%n / /layout /appender Replace this section: category name=com.test.me priority value=debug / appender-ref ref=A1 / /category category name=com.test.me.my.Test priority value=debug / appender-ref ref=A2 / /category root appender-ref ref=A1 / appender-ref ref=A2 / /root with: !-- all requests from com.test.me.my.Test or descendents go to A2 and do not propagate to root -- logger name=com.test.me.my.Test additivity=false appender-ref ref=A2/ /logger !-- any requests except those from com.test.me go to A1 -- root level value=debug/ appender-ref ref=A1/ /root /log4j:configuration Your configuration would have routed messages from com.test.me to A1 twice and once to A2. Messages from com.test.me.my.Test would have gone to A1 twice and A2 twice. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ECCN classification for log4j
Yes, U.S. citizens have contributed to the software. Search the archives -- I think this was discussed before. On 8/21/07, Henriques, Tiago (ext) [EMAIL PROTECTED] wrote: Hi all, We are using log4j in one of our products, and are now in the process of collecting the information needed to export it to other countries. In order to do this, can you tell me whether any citizens of the United States of America or people living in the U.S.A. have contributed to the log4j software? Can you also tell me what the U.S. Export Control Classification Number (ECCN) for log4j is, and whether a license exception may be used for it? In addition to the U.S. ECCN, there is also a German ECCN, which is called the AL Number. Can you tell me what the AL Number is for log4j? To better understand the meaning of the U.S. ECCN, please check the following webpage: http://www.bis.doc.gov/Licensing/Do_I_NeedAnECCN.html Many thanks, Tiago Henriques Nokia Siemens Networks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem with Location of the log file
If you use an XML config file then it can refer to system properties. Example: param name=File value='${catalina.base}/logs/'MMM-dd-EEE'/'HH-mm-ss-S'.log' / I don't know if something similar exists for properties files. On 8/16/07, Rajpurkar, Amit {PI} [EMAIL PROTECTED] wrote: Hi, I have just started to user Log4j. The logging is working good. I have one problem -- I want to make the output log file location portable, rather than dependent on each machine. In the configuration file I have log4j.appender.R.File=D:/Documents and Settings/ARajpur/.netbeans/5.5.1/apache-tomcat-5.5.17_base/logs/applicat ionLogs_VFM.log When ever I deploy my applocation to test server, I need to modify it to log4j.appender.R.File=E:/java/Tomcat 5.0/logs/applicationLogs_VFM.log Is there any way in which I don't have to hard code the file path on different machines?? Thanks and Regards, -Amit THIS ELECTRONIC MAIL MESSAGE AND ITS CONTENTS ARE INTENDED ONLY FOR THE USE OF THE ADDRESSED RECIPIENT(S) AND MAY CONTAIN INFORMATION THAT IS PRIVILEGED, CONFIDENTIAL, AND EXEMPT FROM DISCLOSURE UNDER APPLICABLE LAW. IF YOU ARE NOT AN INTENDED RECIPIENT, OR THE AGENT RESPONSIBLE FOR DELIVERING THIS EMAIL TO THE INTENDED RECIPIENT(S), YOU ARE HEREBY NOTIFIED THAT ANY USE, DISSEMINATION, DISTRIBUTION, OR COPYING OF THIS COMMUNICATION IS STRICTLY PROHIBITED AND MAY BE UNLAWFUL. IF YOU RECEIVED THIS EMAIL IN ERROR, PLEASE NOTIFY THE SENDER IMMEDIATELY BY REPLYING TO THIS EMAIL OR BY TELEPHONE, AND DELETE THE EMAIL SENT IN ERROR -- James A. N. Staufferhttp://www.geocities.com/stauffer_james/ Are you good? Take the test at http://www.livingwaters.com/good/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]