Re: AW: where can I find log4j.dtd on the web
At 08:59 12.04.2001 +0200, Kurt, Oliver wrote: >hi ceki, > >basically you're right. One the one hand waste of resources is true, but on >the other hand you get (at least a litle bit) simplicity of installation >(someone can't forget to copy the log4j.dtd :-) The DTD is part of log4j.jar. Thus, if you can get to log4j classes you should be able to get at the log4j.DTD. Here is one way of doing it: InputSource inputSource = new InputSource(input); URL dtdURL = DOMConfigurator.class.getResource("log4j.dtd"); if(dtdURL == null) { LogLog.error("Could not find log4j.dtd."); } else { LogLog.debug("URL to log4j.dtd is [" + dtdURL.toString()+"]."); inputSource.setSystemId(dtdURL.toString()); } Document doc = docBuilder.parse(inputSource); >and the DTD is available on the jakarta web site: >http://jakarta.apache.org/log4j/javadoc/org/apache/log4j/xml/doc-files/log4j >.dtd Well, I would not count on that URL. It is not intended to be referenced and might vanish, move, etc. etc. Hope the above helps. Ceki >regards >Oliver Kurt > > >-Ursprüngliche Nachricht- >Von: Ceki Gülcü [mailto:[EMAIL PROTECTED]] >Gesendet: Mittwoch, 11. April 2001 18:39 >An: LOG4J Users Mailing List >Cc: Kurt, Oliver >Betreff: Re: where can I find log4j.dtd on the web > > > >Hi Oliver, > >Unfortunately, log4j.dtd is not available at the jakarta web-site. We could >of course easily remedy that. However, what would be the benefits of getting >the log4j.dtd from the web? Wouldn't it be a waste of resources? An >explanation is most welcome. Ceki > >At 11:28 10.04.2001 +0200, Kurt, Oliver wrote: >>hi, >> >>I don't want to use: >> >> >> >>instead of that I want to point to an "web-URL". >> >>Is the log4j.dtd available on a jakarta-web-site ? And if it is, where can >I >>find it? >> >>thanks >>Oliver Kurt > >-- >Ceki Gülcü Web: http://qos.ch >email: [EMAIL PROTECTED] or [EMAIL PROTECTED] > >- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] -- Ceki Gülcü Web: http://qos.ch email: [EMAIL PROTECTED] or [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
AW: where can I find log4j.dtd on the web
hi ceki, basically you're right. One the one hand waste of resources is true, but on the other hand you get (at least a litle bit) simplicity of installation (someone can't forget to copy the log4j.dtd :-) and the DTD is available on the jakarta web site: http://jakarta.apache.org/log4j/javadoc/org/apache/log4j/xml/doc-files/log4j .dtd regards Oliver Kurt -Ursprüngliche Nachricht- Von: Ceki Gülcü [mailto:[EMAIL PROTECTED]] Gesendet: Mittwoch, 11. April 2001 18:39 An: LOG4J Users Mailing List Cc: Kurt, Oliver Betreff: Re: where can I find log4j.dtd on the web Hi Oliver, Unfortunately, log4j.dtd is not available at the jakarta web-site. We could of course easily remedy that. However, what would be the benefits of getting the log4j.dtd from the web? Wouldn't it be a waste of resources? An explanation is most welcome. Ceki At 11:28 10.04.2001 +0200, Kurt, Oliver wrote: >hi, > >I don't want to use: > > > >instead of that I want to point to an "web-URL". > >Is the log4j.dtd available on a jakarta-web-site ? And if it is, where can I >find it? > >thanks >Oliver Kurt -- Ceki Gülcü Web: http://qos.ch email: [EMAIL PROTECTED] or [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how to disable printstacktrace
Zsolt, This was never asked before and as such is not a supported option. Ceki At 22:54 11.04.2001 +0200, you wrote: >is there an easy way to disable/enable printing stack traces of the >throwables (included in the logging event)? >(eg. if i use BasicConfigurator) > -- Ceki Gülcü Web: http://qos.ch email: [EMAIL PROTECTED] or [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Extending Priority class
Jeffrey, Have a look at the examples under org/apache/log4j/xml/examples/X*.java and the XML configuration files extension*.xml. It is not yet possible to use custom priorities in property files. For the mailing archives, see http://jakarta.apache.org/site/mail2.html. Regards, Ceki At 21:56 11.04.2001 -0400, you wrote: >Sorry if this is an oft-times repeated thread, but I was wondering if it >is possible to configure logj4 to use a different priority scheme, one >that extends the Priority class? I find the five or so levels provided >insufficient for my development needs, plus I am more accustomed to a >numerical log-level system (i.e. I don't want to have to remember that >ERROR is more verbose than WARN, etc.; 10 is verbose, 0 ain't). From >what I can tell, I would have to write a custom extension of the >PropertyConfigurator to do this. There is nothing in the documentation >that tells me how to configure the existing system to use a different >Priority system (unless I just haven't found it yet). Any guidance? >Thanx in advance! > >jeff > >ps if there are searchable archives of the mailing list out there, >please tell me where so I can do some digging! -- Ceki Gülcü Web: http://qos.ch email: [EMAIL PROTECTED] or [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Extending Priority class
Sorry if this is an oft-times repeated thread, but I was wondering if it is possible to configure logj4 to use a different priority scheme, one that extends the Priority class? I find the five or so levels provided insufficient for my development needs, plus I am more accustomed to a numerical log-level system (i.e. I don't want to have to remember that ERROR is more verbose than WARN, etc.; 10 is verbose, 0 ain't). From what I can tell, I would have to write a custom extension of the PropertyConfigurator to do this. There is nothing in the documentation that tells me how to configure the existing system to use a different Priority system (unless I just haven't found it yet). Any guidance? Thanx in advance! jeff ps if there are searchable archives of the mailing list out there, please tell me where so I can do some digging! -- Jeffrey & Nikole Bonevich Maxmillian Bonevich Ann Arbor, Michigan [EMAIL PROTECTED] http://www.bonevich.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Websphere class problem with log4j - Solved
I have solved this problem, but the solution was unrelated, so I didn't think of sending it to the list. But here it is: If you are interested - here's what happened: When you import and EJB into Websphere, you must use a command line utility to import the classes into Websphere, as well as their configuration. We bundle all the classes into one jar, and run the command line over that jar. (Not my choice - I would prefer to separate EJB's into a separate jar and import them manually). As it turns out, all my servlets were being loaded from this jar, and not through the normal web-container's classpath. Why this happens I don't know. I can tell you that if your servlets are being loaded from there, then they do not have access to the web container's classpath. Hence my issue. (As log4j sits in the web container's classpath). Solutions: a) Remove Servlet from jar that gets loaded as EJBs b) Include log4j classes in that jar. (a) is the better solution, and that is what I am trying to get implemented here. Thanks for chasing this up! Scott >>> Ceki Gülcü <[EMAIL PROTECTED]> 04/12/01 02:44am >>> Have you solved the problem or do you still need help? Ceki At 08:48 10.04.2001 +1000, you wrote: >I know that it is probably a Websphere problem, but I'm hoping that perhaps someone >has come across this before: > >When using log4j from a jsp, I have no problems. As soon as I use it from a servlet, >I get the following error: >java.lang.NoClassDefFoundError: org/apache/log4j/Category > >Can anyone shed any light on why the jsp classloader has no problems, whilst the >servlet one does? > >Thanks > >Scott > >java.lang.NoClassDefFoundError: org/apache/log4j/Category >at com.swc.cibs.edeveloper.LogTest.doGet(LogTest.java:47) >at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) >at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) >at >com.ibm.servlet.engine.webapp.StrictServletInstance.doService(ServletManager.java:626) >at >com.ibm.servlet.engine.webapp.StrictLifecycleServlet._service(StrictLifecycleServlet.java:160) >at >com.ibm.servlet.engine.webapp.IdleServletState.service(StrictLifecycleServlet.java:287) >at >com.ibm.servlet.engine.webapp.StrictLifecycleServlet.service(StrictLifecycleServlet.java:105) >at >com.ibm.servlet.engine.webapp.ServletInstance.service(ServletManager.java:360) >at >com.ibm.servlet.engine.webapp.ValidServletReferenceState.dispatch(ServletManager.java:775) >at >com.ibm.servlet.engine.webapp.ServletInstanceReference.dispatch(ServletManager.java:701) >at >com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:404) >at >com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:203) >at >com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:107) >at >com.ibm.servlet.engine.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:77) >at >com.ibm.servlet.engine.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:67) >at >com.ibm.servlet.engine.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:155) >at >com.ibm.servlet.engine.oselistener.OSEListenerDispatcher.service(OSEListener.java:300) >at >com.ibm.servlet.engine.oselistener.SQEventListenerImp$ServiceRunnable.run(SQEventListenerImp.java:230) >at >com.ibm.servlet.engine.oselistener.SQEventListenerImp.notifySQEvent(SQEventListenerImp.java:104) >at >com.ibm.servlet.engine.oselistener.serverqueue.SQEventSource.notifyEvent(SQEventSource.java:212) >at >com.ibm.servlet.engine.oselistener.serverqueue.SQWrapperEventSource$SelectRunnable.notifyService(SQWrapperEventSource.java:353) >at >com.ibm.servlet.engine.oselistener.serverqueue.SQWrapperEventSource$SelectRunnable.run(SQWrapperEventSource.java:220) >at >com.ibm.servlet.engine.oselistener.outofproc.OutOfProcThread$CtlRunnable.run(OutOfProcThread.java:248) >at java.lang.Thread.run(Thread.java:481) > > > > > > >- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] -- Ceki Gülcü Web: http://qos.ch email: [EMAIL PROTECTED] or [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
FW: problem with getting unique log file by class
-Original Message- From: Michael Robkin [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 11, 2001 4:57 PM To: '[EMAIL PROTECTED]' Subject:FW: problem with getting unique log file by class -Original Message- From: Michael Robkin [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 11, 2001 3:31 PM To: '[EMAIL PROTECTED]' Subject:problem with getting unique log file by class Hi Any help would be greatly appreciated Thanks Michael[EMAIL PROTECTED] i have included my xml below. I am trying to define another category class. It is in bold at the bottom. I get the following error at runtime og4j:ERROR Could not retrieve category []. Reported error follows. java.lang.NoSuchMethodException: getInstanceat java.lang.Class.getMethod0(Native Method) at java.lang.Class.getMethod(Class.java:888) at org.apache.log4j.xml.DOMConfigurator.parseCategory(DOMConfigurator.java:294) at org.apache.log4j.xml.DOMConfigurator.parse(DOMConfigurator.java:636) at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:567) at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:513) at org.apache.log4j.xml.DOMConfigurator.configure(DOMConfigurator.java:582) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
how to disable printstacktrace
is there an easy way to disable/enable printing stack traces of the throwables (included in the logging event)? (eg. if i use BasicConfigurator) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem with getting unique log file by class
Michel, Your XML config file is totally messed up. Is com.hbsrx.ejb.service.value.OrderDetailInfoValue a subclass of Category? Probably not... Ceki At 15:30 11.04.2001 -0400, Michael Robkin wrote: >Hi > > Any help would be greatly appreciated > > Thanks > > > > Michael[EMAIL PROTECTED] > > > i have included my xml below. > > I am trying to define another category class. It is in bold at the bottom. > > I get the following error at runtime > >og4j:ERROR Could not retrieve category []. Reported error follows. >java.lang.NoSuchMethodException: getInstanceat >java.lang.Class.getMethod0(Native Method) at >java.lang.Class.getMethod(Class.java:888) at >org.apache.log4j.xml.DOMConfigurator.parseCategory(DOMConfigurator.java:294) >at org.apache.log4j.xml.DOMConfigurator.parse(DOMConfigurator.java:636) at >org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:567) >at >org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:513) >at org.apache.log4j.xml.DOMConfigurator.configure(DOMConfigurator.java:582) > > > > > > > > > > > > > > > > > > > > > > > value="%d %-5p [%t] %C{2} (%F:%L) - %m\n"/> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] -- Ceki Gülcü Web: http://qos.ch email: [EMAIL PROTECTED] or [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: LoggingEvent.throwableInfo
Jim, I just added missing getThrowableInformation method in LoggingEvent. That should solve the problem. Cheers, Ceki ps: What you want is probably event.getThrowableInformation().getThrowable(). At 16:23 11.04.2001 -0400, you wrote: >In the version of log4j that's in CVS right now I can't find any way to get >the Throwable that was given to the LoggingEvent. There's a ThrowableInfo >that's stored in the LoggingEvent, which has a public getThrowable() method, >but there's no way to get the ThrowableInfo. There's a getThrowableStrRep() >method, but you can't do an instanceof SQLException on that or query that >for the object's members. > >Is there some way to get the Throwable from LoggingEvent that I'm missing? > >-Jim Moore -- Ceki Gülcü Web: http://qos.ch email: [EMAIL PROTECTED] or [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: reloading configuration at runtime
> You can use the example Category in > org.apache.log4j.examples.appserver. I'd like to make this part of the > main stream distribution (remove the "examples" from the package name). > But first I need to iron out some of the configuration difficulties it > has (as well as all other extensions like it). erik:~/download/jakarta-log4j-1.0.4$ find . -name "*ppserver*" erik:~/download/jakarta-log4j-1.0.4$ Paul, I can't find any appserver files in the distribution. The only files in the example dir include a NumberCruncher and some Pattern and Category examples. Erik -- Real programmers don't bring brown-bag lunches. If the vending machine doesn't sell it, they don't eat it. Vending machines don't sell quiche. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: help with Wrapping/Buffering
Title: RE: help with Wrapping/Buffering Hi, Ross. Have a look at the source for org.apache.log4j.spi.LocationInfo. Best regards, Jim Cakalic > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, April 10, 2001 5:19 AM > To: [EMAIL PROTECTED] > Subject: help with Wrapping/Buffering > > > Hi there, > I've just started using log4j (and am still a newbie to java > itself).I am using a wrapper class around log4j, and part of > what my wrapper does is to buffer log items, only sending > them to log4j when certain events occur. Clearly by doing > this, I lose log4j's ability to automatically retrieve > methods, line numbers etc. from the caller. > > It seems like what I have to do is to retrieve this > information before I add an individual log to the buffer, > then send it as part of the message string to log4j. > Obviously I would lose some flexibility in the PatternLayout > function, but this is not crucial. > > I understand that log4j somehow gets this information from a > stack trace, but I am unsure of exactly how this works, or > how I would go about getting the information for myself. > > Thanks in advance for any help, > > Ross Ovland > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] >
log4j.dtd, org.xml.sax.SAXParseException, file not found
Hello, I have a little problem. Perhaps it is not really related to log4j, but I have it with the log4j dtd, and I cannot find information otherwise, so perhaps there is someone who had the same problem and solved it. My DOMConfigurator xml starts something like this: http://jakarta.apache.org/log4j/javadoc/org/apache/log4j/xml/doc-files/log4j.dtd"[ and then it works, but I prefer to have the dtd locally, because we don't want to depend on an internet connection, and since it is in the jar, and simply SYSTEM "log4j.dtd" seems to find at least the location of it nicely, I want it to work like this. In fact, I think it works for some others, but it doesn't for me. So what can be wrong? The xerces I use it this one: -rw-r--r--1 root beheer1605266 Feb 1 16:00 xerces.jar 1.3.0 and jndi: -rw-r--r--1 root ontwik 98496 Mar 2 2000 jndi.jar 1.2 anything else what could be important? log4j 1.0.4 ~$ java -version java version "1.3.0_02" Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0_02) Java HotSpot(TM) Client VM (build 1.3.0_02, mixed mode) ~$ uname -a Linux dale 2.2.15-3SGI_32smp-bigmem #1 SMP Thu Jun 15 15:52:09 EDT 2000 i686 unknown greetings, Michiel -- Michiel Meeuwissen - NOS internet Mediacentrum kamer 203 - tel. +31 (0)35 6773065 http://www.mmbase.org http://www.purl.org/NET/mihxil/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: About the debug method of class Category.
Hi Betty, This is normal because Exceptions do not survive serialization. In LoggingEvent there is a method called getThrowableInformation which returns the string representation of the exception including stack trace. One problem with this approach is that this string representation is not as easy to manipulate as the raw thorwable. In log4j 1.1, there will be a new object that will represent exceptions including stack trace which will not suffer from the above problem and will be serializable unlike java.lang.Throwable. Regards, Ceki --- Betty <[EMAIL PROTECTED]> wrote: > Dear all, > > I try to log a message with debug method > I pass the message and throwable to it. > I find that I cannot read back the throwable in > server side. > It returns a null object to me. > How can I read it back in ServerSide? > > Betty Pang > > > - > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > = - Ceki Gulcu E-mail: [EMAIL PROTECTED] Rumine 5 Tel:++41-21-351 23 15 CH-1005 Lausanne/Switzerland __ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Regarding Multiple Appenders and Configuration
Sir, Iam getting the multiple outputs of each type of logging events. But i used seperate Category instance for every priority using Threshold variable. public static Category NORM = Category.getInstance("NORM");public static Category DEV = Category.getInstance("DEV");public static Category SPEED = Category.getInstance("SPEED");public static Category MAT = Category.getInstance("MAT"); Hope u can suggest still some other ways. Also I have doubts of using LogLog, ErrorHandler Class. How this r useful in logging? Regards, Anand. ---Original Message--- From: anand <[EMAIL PROTECTED]> Date: Saturday, April 07, 2001 01:51:07 AM To: Log4j <[EMAIL PROTECTED]> Subject: Multiple Appenders using Threshold Sir, Iam not able to do multiple outputs with multiple appenders using THRESHOLD of AppenderSkeleton. Either it overwrites in a single file. I want to append ERROR mesg to one appender, lllr case for others too. If u have any ideas or suggestions, pls help me to solve this problem. So it will be useful implementing log4j. Here is the Config File. log4j.rootCategory=NORM,f log4j.appender.f=org.apache.log4j.FileAppenderlog4j.appender.f.MaxFileSize=10MBlog4j.appender.f.MaxBackupIndex=3log4j.appender.f.layout=org.apache.log4j.TTCCLayoutlog4j.appender.f.layout.ContextPrinting=enabledlog4j.appender.f.layout.DateFormat=ISO8601log4j.appender.f.File=tester.loglog4j.appender.f.Append=true log4j.appender.f1=org.apache.log4j.FileAppenderlog4j.appender.f1.MaxFileSize=10MBlog4j.appender.f1.MaxBackupIndex=3log4j.appender.f1.layout=org.apache.log4j.TTCCLayoutlog4j.appender.f1.layout.ContextPrinting=enabledlog4j.appender.f1.layout.DateFormat=ISO8601log4j.appender.f1.File=tester1.loglog4j.appender.f1.Append=true log4j.appender.f2=org.apache.log4j.FileAppenderlog4j.appender.f2.MaxFileSize=10MBlog4j.appender.f2.MaxBackupIndex=3log4j.appender.f2.layout=org.apache.log4j.TTCCLayoutlog4j.appender.f2.layout.ContextPrinting=enabledlog4j.appender.f2.layout.DateFormat=ISO8601log4j.appender.f2.File=tester2.loglog4j.appender.f2.Append=true log4j.appender.f3=org.apache.log4j.FileAppenderlog4j.appender.f3.MaxFileSize=10MBlog4j.appender.f3.MaxBackupIndex=3log4j.appender.f3.layout=org.apache.log4j.TTCCLayoutlog4j.appender.f3.layout.ContextPrinting=enabledlog4j.appender.f3.layout.DateFormat=ISO8601log4j.appender.f3.File=tester3.loglog4j.appender.f3.Append=true log4j.appender.f.Threshold=ERRORlog4j.appender.f1.Threshold=DEBUGlog4j.appender.f2.Threshold=WARNlog4j.appender.f3.Threshold=INFO log4j.category.NORM=ERROR, flog4j.category.NORM = DEBUG, f1log4j.category.NORM = WARN, f2log4j.category.NORM = INFO, f3 Regards, Anand Manoharan. __IncrediMail - Email has finally evolved - Click Here
Configure Problems
Sir, I got a Problem in Configuration. I only Configure once in a class and have created instances of Category in the same class. When Calling those instances in other classes it shows some errors such as not configured and no appenders found. log4j:ERROR No appenders could be found for category (DEV).log4j:ERROR Please initialize the log4j system properly. Is it i have to configure Log4j in all the classes. Iam using PropertyConfigurator in this case. So pls help us to solve this problem Regards, Anand. __IncrediMail - Email has finally evolved - Click Here
Re: where can I find log4j.dtd on the web
"Kurt, Oliver" <[EMAIL PROTECTED]> wrote: > hi, > > I don't want to use: > > > > instead of that I want to point to an "web-URL". > > Is the log4j.dtd available on a jakarta-web-site ? And if it is, where can I > find it? I do have excactly the inverse problem. I want to don't want to use the log4j.dtd from the jakarta web-site (a.o. indeed because that seems a waist of resources), but to get it from the jar. But it yields this exception: org.xml.sax.SAXParseException: File "jndi:/bigdisk/dev/lib/test/log4j.jar/org/apache/log4j/xml/log4j.dtd" not found. What could be the difference? Michiel PS, i get ti from the web-site with: http://jakarta.apache.org/log4j/javadoc/org/apache/log4j/xml/doc-files/log4j.dtd"[ -- Michiel Meeuwissen - NOS internet Mediacentrum kamer 203 - tel. +31 (0)35 6773065 http://www.mmbase.org http://www.purl.org/NET/mihxil/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
problem with getting unique log file by class
Hi Any help would be greatly appreciated Thanks Michael[EMAIL PROTECTED] i have included my xml below. I am trying to define another category class. It is in bold at the bottom. I get the following error at runtime og4j:ERROR Could not retrieve category []. Reported error follows. java.lang.NoSuchMethodException: getInstanceat java.lang.Class.getMethod0(Native Method) at java.lang.Class.getMethod(Class.java:888) at org.apache.log4j.xml.DOMConfigurator.parseCategory(DOMConfigurator.java:294) at org.apache.log4j.xml.DOMConfigurator.parse(DOMConfigurator.java:636) at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:567) at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:513) at org.apache.log4j.xml.DOMConfigurator.configure(DOMConfigurator.java:582) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: SNMP support in log4j
Van, There is no SNMP support in log4j. You are welcome to add it though... :-) Ceki At 11:31 11.04.2001 -0700, Veerappan Saravanan wrote: > Sorry guys, I did confuse SNMP with SMTP. Maybe, Ceki knows the easiest >way to get a hold of a SNMP appender. > >Ceki, your help will be appreciated! > >Van > >-Original Message- >From: Alan Robertson >To: LOG4J Users Mailing List >Sent: 4/11/01 10:44 AM >Subject: Re: SNMP support in log4j > >Am I missing something or did you confuse SMTP for SNMP? > >Speaking of SNMP, has anyone done any work on an appender which can >issue SNMP >traps? My boss was curious about this functionality. > >Thanks, >Alan > >Veerappan Saravanan wrote: > >> Never mind, found the answer in version 1.04. There's a SNMPAppender >under >> org.apache.log4j.net. >> >> It's been there since version 1.0 >> >> -Original Message- >> From: Veerappan Saravanan [mailto:[EMAIL PROTECTED]] >> Sent: Tuesday, April 10, 2001 1:25 PM >> To: '[EMAIL PROTECTED]' >> Subject: SNMP support in log4j >> >> Does log4j have snmp support? Can anyone point me to a location where >I can >> find more information on it. >> >> Thanks >> Van -- Ceki Gülcü Web: http://qos.ch email: [EMAIL PROTECTED] or [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
LoggingEvent.throwableInfo
In the version of log4j that's in CVS right now I can't find any way to get the Throwable that was given to the LoggingEvent. There's a ThrowableInfo that's stored in the LoggingEvent, which has a public getThrowable() method, but there's no way to get the ThrowableInfo. There's a getThrowableStrRep() method, but you can't do an instanceof SQLException on that or query that for the object's members. Is there some way to get the Throwable from LoggingEvent that I'm missing? -Jim Moore - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: SNMP support in log4j
Sorry guys, I did confuse SNMP with SMTP. Maybe, Ceki knows the easiest way to get a hold of a SNMP appender. Ceki, your help will be appreciated! Van -Original Message- From: Alan Robertson To: LOG4J Users Mailing List Sent: 4/11/01 10:44 AM Subject: Re: SNMP support in log4j Am I missing something or did you confuse SMTP for SNMP? Speaking of SNMP, has anyone done any work on an appender which can issue SNMP traps? My boss was curious about this functionality. Thanks, Alan Veerappan Saravanan wrote: > Never mind, found the answer in version 1.04. There's a SNMPAppender under > org.apache.log4j.net. > > It's been there since version 1.0 > > -Original Message- > From: Veerappan Saravanan [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, April 10, 2001 1:25 PM > To: '[EMAIL PROTECTED]' > Subject: SNMP support in log4j > > Does log4j have snmp support? Can anyone point me to a location where I can > find more information on it. > > Thanks > Van > > - > 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]
RE: Convenience overloads in Category
Bingo. And you can store static information, like bundle name, product version and such, in the convenience class so it's available without having to marshall it around. > -Original Message- > From: Michael Brennan [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, April 11, 2001 1:36 PM > To: 'LOG4J Users Mailing List' > Subject: RE: Convenience overloads in Category > > > Another approach to achieve the same goal (and which doesn't violate > internationalization guidelines) is to write a convenience > class that wraps > the funcionality of the MessageFormat class, and use that to > construct the > messages provided to log4j. That's what I do. > > > -Original Message- > > From: Johnson, Clay [mailto:[EMAIL PROTECTED]] > > Sent: Wednesday, April 11, 2001 9:21 AM > > To: 'LOG4J Users Mailing List' > > Subject: RE: Convenience overloads in Category > > > > > > Internationalization. Rule 1 is don't concatenate strings > to compose > > messages; it makes translation much more costly and invasive. > > Ideally, > > store messages in resource bundles, and if they are > parameterized, use > > MessageFormat. > > > > That is, if you need to be global, and I assume many log4j > users do. > > > > - > 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: Convenience overloads in Category
Another approach to achieve the same goal (and which doesn't violate internationalization guidelines) is to write a convenience class that wraps the funcionality of the MessageFormat class, and use that to construct the messages provided to log4j. That's what I do. > -Original Message- > From: Johnson, Clay [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, April 11, 2001 9:21 AM > To: 'LOG4J Users Mailing List' > Subject: RE: Convenience overloads in Category > > > Internationalization. Rule 1 is don't concatenate strings to compose > messages; it makes translation much more costly and invasive. > Ideally, > store messages in resource bundles, and if they are parameterized, use > MessageFormat. > > That is, if you need to be global, and I assume many log4j users do. > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Time stamping of log messages
Thanks Ceki - Rob SoftSell Business Systems, Ltd. ' testing solutions for a changing world ' +44 (20) 7488 3470 www.softsell.com [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: SNMP support in log4j
Am I missing something or did you confuse SMTP for SNMP? Speaking of SNMP, has anyone done any work on an appender which can issue SNMP traps? My boss was curious about this functionality. Thanks, Alan Veerappan Saravanan wrote: > Never mind, found the answer in version 1.04. There's a SNMPAppender under > org.apache.log4j.net. > > It's been there since version 1.0 > > -Original Message- > From: Veerappan Saravanan [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, April 10, 2001 1:25 PM > To: '[EMAIL PROTECTED]' > Subject: SNMP support in log4j > > Does log4j have snmp support? Can anyone point me to a location where I can > find more information on it. > > Thanks > Van > > - > 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]
Re: Time stamping of log messages
At 18:06 11.04.2001 +0100, you wrote: >Ceki, > >> >> What Paul described is certainly true for the newest code in our >CVS rep. As far as I know, 1.1b1 or any previous version the >PatternLayout does time stamping when formatting the event, not >when the event was created. This was a silly bug that has been >corrected in the code in our CVS rep. In other words, in 1.1b2 and >later versions, PatternLayout will use the time stamp that was >minted when the LoggingEvent was created or approximately at the >same time as the logging statement was invoked. Hope this further >clarifies the matter, Ceki > >Many thanks - was beginning to think I was seeing things! > >Not that familiar with CVS or the Dev. source trees. Can I just grab >a copy, and are there any "stability" issues i.e. whay stage is >version 1.1b2 in the develop/test cycle? 1.1b1 is basically a maintenance release ironing out rough edges with 1.0.4. On the other hand, 1.1b2 has a number of changes, in particular the JavaBeans type configuration added by Anders Kristensen. The new code passes our regression tests so it should be quite OK. The problem with code in our CVS repository is that changes can be committed before being fully tested. So the code in the CVS rep is not guaranteed to work well in production environments. Coming back to the issue at hand, I suggest that you simply patch 1.1b1 by changing org/apache/log4j/helpers/PatternParser.java. See http://jakarta.apache.org/site/cvsindex.html for changes that occured in PatternParser.java. The relevant patch is copied below: === RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/helpers/PatternParser.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- jakarta-log4j/src/java/org/apache/log4j/helpers/PatternParser.java 2001/01/22 10:57:27 1.4 +++ jakarta-log4j/src/java/org/apache/log4j/helpers/PatternParser.java 2001/03/20 +16:05:46 1.5 @@ -22,6 +22,7 @@ // Contributors: Nelson Minar <([EMAIL PROTECTED]> // Igor E. Poteryaev <[EMAIL PROTECTED]> +// Reinhard Deschler <[EMAIL PROTECTED]> /** Most of the work of the {@link org.apache.log4j.PatternLayout} class @@ -426,7 +427,7 @@ public String convert(LoggingEvent event) { - date.setTime(System.currentTimeMillis()); + date.setTime(event.timeStamp); return df.format(date); } } @@ -477,7 +478,7 @@ // We substract 1 from 'len' when assigning to 'end' to avoid out of // bounds exception in return r.substring(end+1, len). This can happen if - // precision is 1 and the category name ends with a dot. you + // precision is 1 and the category name ends with a dot. int end = len -1 ; for(int i = precision; i > 0; i--) { end = n.lastIndexOf('.', end-1); The modification that we are interested in is replacing date.setTime(System.currentTimeMillis()); with date.setTime(event.timeStamp); on line 430 or so in PatternParser.java. Regards, Ceki ps: It's a lot of words for not much. As I said, it was a silly bug. -- Ceki Gülcü Web: http://qos.ch email: [EMAIL PROTECTED] or [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: help with Wrapping/Buffering
Ross, See how the AsyncAppender does it. Ceki At 11:19 10.04.2001 +0100, you wrote: >Hi there, >I've just started using log4j (and am still a newbie to java itself).I am using a >wrapper class around log4j, and part of what my wrapper does is to buffer log items, >only sending them to log4j when certain events occur. Clearly by doing this, I lose >log4j's ability to automatically retrieve methods, line numbers etc. from the caller. > >It seems like what I have to do is to retrieve this information before I add an >individual log to the buffer, then send it as part of the message string to log4j. >Obviously I would lose some flexibility in the PatternLayout function, but this is >not crucial. > >I understand that log4j somehow gets this information from a stack trace, but I am >unsure of exactly how this works, or how I would go about getting the information for >myself. > >Thanks in advance for any help, > >Ross Ovland -- Ceki Gülcü Web: http://qos.ch email: [EMAIL PROTECTED] or [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Time stamping of log messages
Ceki, > > What Paul described is certainly true for the newest code in our CVS rep. As far as I know, 1.1b1 or any previous version the PatternLayout does time stamping when formatting the event, not when the event was created. This was a silly bug that has been corrected in the code in our CVS rep. In other words, in 1.1b2 and later versions, PatternLayout will use the time stamp that was minted when the LoggingEvent was created or approximately at the same time as the logging statement was invoked. Hope this further clarifies the matter, Ceki Many thanks - was beginning to think I was seeing things! Not that familiar with CVS or the Dev. source trees. Can I just grab a copy, and are there any "stability" issues i.e. whay stage is version 1.1b2 in the develop/test cycle? Regards -- rob -- SoftSell Business Systems, Ltd. ' testing solutions for a changing world ' +44 (20) 7488 3470 www.softsell.com [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Newbie in.help needed..(basics)
I looks just like the log4j Category, only I didn't expose all the methods. Again, my purpose wasn't to isolate log4j dependency; I agree with the earlier comment that it's just one import statement. Rather, I wanted the methods to use a custom hierarchy rather than the default, so I could control the namespace within an application that might incorporate thirdparty components that also use log4j. So, the "wrapper" looks just like log4j Category, sans a few methods, but it is implemented with a delegate pattern using a derived category class (I needed additional member variables for another purpose) that also implements CategoryFactory and holds a static, custom hierarchy. Sort of like: public myCategory extends Object { // extends Category, implements CategoryFactory, uses custom hierarchy private Delegate myDelegate; public static myCategory getInstance(String name) { myCategory cat = new myCategory(); cat.myDelegate = (Delegate) myDelegate.getInstance(name); return cat; } public error(String message) { myDeletgate.error(message); } ... } I could have had myCategory simply extend log4j Category, but there was interest not exposing all the methods. The delegate pattern is one way to do that. If you don't share these or other compelling reasons, it's not clear to me a wrapper buys you anything. > -Original Message- > From: Ralf Krakowski [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, April 11, 2001 11:17 AM > To: 'LOG4J Users Mailing List' ' > Subject: RE: Newbie in.help needed..(basics) > > > Clay , > Could you please provide a simple example of how a wrapper > class might look > and how to call that class (what parameters and so on)? > > Thanks > > Ralf > > -Original Message- > From: Johnson, Clay > To: 'LOG4J Users Mailing List' > Sent: 2001-04-11 18:10 > Subject: RE: Newbie in.help needed..(basics) > > > Has anybody had any experience with wrapping log4j? > > Yes, but not for isolation. Rather, I needed a custom hierarchy and > category, so I was already there. The config side is straight log4j. > > > > > Is the 1.1beta stable enought for development? > > > > I haven't had any problems going on a month or so. > > - > 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]
Re: Time stamping of log messages
At 19:48 08.04.2001 +0100, you wrote: >Paul > >> I'm work on an application that logs across timezones. The timestamp I >> see in the DOS box inside of PC Anywhere connecting to the remote >> machine is one hour different than the timestamp I see in a local DOS >> box being fed by a SimpleSocketServer. Since the SimpleSocketServer >> also receives events from servers in the same timezone, the log file is >> consistent in using a single timezone (the local one). >> >> Does this explain what you are seeing? > >Could well be it ... never though the to check the remote machine in >question. Thanks for the tip, I'll look into whether this was the cause. What Paul described is certainly true for the newest code in our CVS rep. As far as I know, 1.1b1 or any previous version the PatternLayout does time stamping when formatting the event, not when the event was created. This was a silly bug that has been corrected in the code in our CVS rep. In other words, in 1.1b2 and later versions, PatternLayout will use the time stamp that was minted when the LoggingEvent was created or approximately at the same time as the logging statement was invoked. Hope this further clarifies the matter, Ceki >-- Rob -- > > > >SoftSell Business Systems, Ltd. >' testing solutions for a changing world ' > >+44 (20) 7488 3470 >www.softsell.com >[EMAIL PROTECTED] > >- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] -- Ceki Gülcü Web: http://qos.ch email: [EMAIL PROTECTED] or [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: WG: Configuration issue with JDBCAppender
Has this been solved? Cheers, Ceki At 00:34 27.03.2001 +0200, you wrote: >Hello Todd, > >youre right, nullpointerexceptions shouldnt happen... > >First i take a look at your given configuration-file. >Whats up with the type of column ObjectName ? Doesnt look well : > ># Columns-option to describe the important columns of the table ># (Not nullable columns are mandatory to describe!) >log4j.appender.JDBC.columns=LogTime~TIMESTAMP >MessageId~ID~com.eaonet.utilities.MyIDHandler MessageText~MSG >ObjectName~getClass().getName() > >All valid types and the syntax for column list is available @ documentaion. >Please check this again ;) > >Now to the exceptions. The exception was definetly raised in >JDBCAppender::connect(). >The class-cast shouldnt be the problem, because there wasnt a >classcastexception... >connectionHandler = (JDBCConnectionHandler) >(Class.forName(connection_class).newInstance()); >So i suppose, that the new instantiated JDBCConnectionHandler isnt willing >to give us a connection. >if (url != null && username != null && password != null) { >con = connectionHandler.getConnection(url, username, >password); >} >else { >con = connectionHandler.getConnection(); >} > >Because con returns as null, the following statement will fail and raise a >nullpointerexception : >if (con.isClosed()) { > >So, i think the problem is something with the DriverManager ...? >con = DriverManager.getConnection(_url, _username, _password); > >Just try to get a connection in a separated HelloWorld-program. >When the DriverManager dont returns a valid Connection there is something >wrong i dont know... >But when that one is working well, send me everything you have including >description of driver and database (also table definition, etc...) >and i will debug , ok ? But first ensure thats not any driver problem ... ;) > > >Thanks for your report ! > >:) Thomas > >-Ursprüngliche Nachricht- >Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] >Gesendet: Freitag, 23. März 2001 21:28 >An: [EMAIL PROTECTED] >Betreff: Configuration issue with JDBCAppender > > >Mr. Fenner, > >I am attempting to use the JDBCAppender developed by yourself and am >encountering the following problems when configuring it. When I leave the >"log4j.appender.JDBC.connector" option comment out, and utilize the >"DefaultConnectionHandler" in the JDBCAppender class I get the following >error: > > log4j:ERROR JDBCAppender::configure(), java.lang.Exception: >JDBCAppender::connect(), java.lang.NullPointerException > >When I create a class to implement the JDBCConnectionHandler interface and >specify it in the connector option, I get the following error: > > log4j:ERROR JDBCAppender::configure(), java.lang.Exception: >JDBCAppender::connect(), java.lang.ClassNotFoundException: Log4jJDBCHandler > >My environment is as follows: > >Tomcat: 3.2.1 >Apache: 1.3.14 >MySQL: 3.23 >OS: WIN 2K >JDK: 1.3 > >The log4j.properties file is as shown below: > >log4j.rootCategory=JDBC > > ># Configure the JDBCAppender >log4j.appender.JDBC=com.klopotek.utils.log.JDBCAppender > ># JDBC is a class of JDBCAppender, which writes messages into the >database >log4j.appender.JDBC.url=jdbc:mysql://localhost:3306/mydb >log4j.appender.JDBC.username=test >log4j.appender.JDBC.password=test > ># Connector-option to specify your own JDBCConnectionHandler >#log4j.appender.JDBC.connector=MyConnectionHandler > ># Table-option to specify one table contained by the database for >loging >log4j.appender.JDBC.table=syslog > ># Columns-option to describe the important columns of the table ># (Not nullable columns are mandatory to describe!) >log4j.appender.JDBC.columns=LogTime~TIMESTAMP >MessageId~ID~com.eaonet.utilities.MyIDHandler MessageText~MSG >ObjectName~getClass().getName() > ># Define the layout of the messages (optional) for the database >log4j.appender.JDBC.layout=org.apache.log4j.PatternLayout >log4j.appender.JDBC.layout.ConversionPattern=%m > ># Buffer-opiton: define the size of the message-event-buffer >(optional) >#log4j.appender.JDBC.buffer=1 > ># Commit-option: define a auto-commitment (optional) >#log4j.appenderlJDBC.commit=Y > ># Print only messages of priority which is equal to or above the >value specified below in the package com.eaonet. ># Possible values: DEBUG, INFO, WARN, ERROR, FATAL >log4j.category.com.myappo=INFO > >I have compiled the JDBCAppender along with the supporting classes and >created a JAR file which I have placed in the TOMCAT_HOME/lib directory. It >is finding the JDBCAppender class ok but is failing on the connector >options. > >I am sure that I must have some
RE: wrapper for Log4j for method entrance/exit?
At 11:54 22.03.2001 -0500, John wrote: >Ceki, >So far as I've seen (aside from AspectJ, which I shied away from because of >the precompiler "voodoo" nature) there is not any *totally* non intrusive >way. > >If you do not have the luxory of a factory that you can do the constructor >interception at, you can do a search and replace style thingie where you: > >Replace:"= new " + * + ");" >with: "= new DebugProxy.for( " + * + ") );" > >So: FooBarClass fb = new FooBarClass(myargs); >Becomes:FooBarClass fb = DebugProxy.for( new FooBarClass(myargs) ); > >And the DebugProxy class is a static class whose .for() method accepts an >object, wraps it in a Proxy and then returns it. (typically only wrapping it >if a debug flag is set.) > >Unfortunatly this uglifies your code a bit, but if you do not have a >factory... You can tweak the DebugProxy.for method to only wrap certain >classes, etc. > >In a way I'd like to see something like this added to log4j's varia package. >I mean it *is* kinda neat (and useful too!) John, OK. So why don't you scratch that itch? I will gladly add your contribution to the log4j distrib. Ceki - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: where can I find log4j.dtd on the web
Hi Oliver, Unfortunately, log4j.dtd is not available at the jakarta web-site. We could of course easily remedy that. However, what would be the benefits of getting the log4j.dtd from the web? Wouldn't it be a waste of resources? An explanation is most welcome. Ceki At 11:28 10.04.2001 +0200, Kurt, Oliver wrote: >hi, > >I don't want to use: > > > >instead of that I want to point to an "web-URL". > >Is the log4j.dtd available on a jakarta-web-site ? And if it is, where can I >find it? > >thanks >Oliver Kurt -- Ceki Gülcü Web: http://qos.ch email: [EMAIL PROTECTED] or [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Convenience overloads in Category
Internationalization. Rule 1 is don't concatenate strings to compose messages; it makes translation much more costly and invasive. Ideally, store messages in resource bundles, and if they are parameterized, use MessageFormat. That is, if you need to be global, and I assume many log4j users do. > -Original Message- > From: Pugh, Eric [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, April 11, 2001 11:02 AM > To: 'LOG4J Users Mailing List' > Subject: RE: Convenience overloads in Category > > > What is i18n? I have seen it referenced a couple times. Is > it a standard? > > Eric > > -Original Message- > From: Johnson, Clay [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, April 11, 2001 10:29 AM > To: 'LOG4J Users Mailing List' > Subject: RE: Convenience overloads in Category > > > That violates i18n. I'd discourage it. > > > -Original Message- > > From: Michael McKibben [mailto:[EMAIL PROTECTED]] > > Sent: Wednesday, April 11, 2001 2:47 AM > > To: [EMAIL PROTECTED] > > Subject: Convenience overloads in Category > > > > > > Hi, I was wondering if the following method overloads in > > Category might be > > useful to help ease the burden associated with logXXX() parameter > > construction. Currently, there are two convenience overloads > > per priority, > > e.g. > > > > void info(Object message); > > void info(Object message, Throwable); > > > > What I find myself doing a lot in my code is something > similar to the > > following: > > > > category.info("message: " + variable + " is not found"); > > > > What if a few extra overloads were added to account for > > multiple message > > parameters, e.g > > > > void info(Object message1, Object message2); > > void info(Object message1, Object message2, Object message3); > > > > Then the user code would be simplified to: > > > > category.info("message: ", variable, " is not found"); > > > > The nice thing is that for the common cases of 1-3 > > parameters, the "hidden" > > StringBuffer goes away. The overloaded methods inside > > Category could reuse a > > common StringBuffer for string concatenation. Plus, you may > > feel less need > > to wrap your log statements with "category.isInfoEnabled()" > > if statements. > > > > Also, for support for more than three message > concatenations, or as an > > alternative to the above idea, an Object[] could be passed > to the one > > argument method, and a special renderer could be called upon > > to deal with > > arrays. For example: > > > > category.info(new Object[]{"message", variable, "is not > > found.", "..."}); > > > > Would be handled by a default ObjectRenderer similar to: > > > > String doRender(Object o) { > > String message; > > Object[] messages = (Object[])o; > > myStringBuffer.setLength(0); > > for (int i=0; i > o = messages[i]; > > message = (o instanceof String)? > >(String)message : > > myRendererMap.findAndRender(o); > > myStringBuffer.append(message); > > } > > return myStringBuffer.toString(); > > } > > > > Is all this more trouble than it's worth? I suppose Category > > could be also > > extended to add this behavior as well, but then configuration > > gets a little > > tricky. Thoughts? > > > > --mike > > > > > > > > > - > > 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]
RE: Newbie in.help needed..(basics)
Clay , Could you please provide a simple example of how a wrapper class might look and how to call that class (what parameters and so on)? Thanks Ralf -Original Message- From: Johnson, Clay To: 'LOG4J Users Mailing List' Sent: 2001-04-11 18:10 Subject: RE: Newbie in.help needed..(basics) > Has anybody had any experience with wrapping log4j? Yes, but not for isolation. Rather, I needed a custom hierarchy and category, so I was already there. The config side is straight log4j. > > Is the 1.1beta stable enought for development? > I haven't had any problems going on a month or so. - 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: What is i18n?
It's geek-speak for "internationalization" which you'll note has 18 characters between the first 'i' and the last 'n' 8-) > -Original Message- > From: Pugh, Eric [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, April 11, 2001 12:02 PM > To: 'LOG4J Users Mailing List' > Subject: RE: Convenience overloads in Category > > > What is i18n? I have seen it referenced a couple times. Is > it a standard? > > Eric> - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Convenience overloads in Category
it means I-nternationalizatio-N "nternationalizatio" has 18 letters, so... -Original Message- From: Pugh, Eric [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 11, 2001 6:02 PM To: 'LOG4J Users Mailing List' Subject: RE: Convenience overloads in Category What is i18n? I have seen it referenced a couple times. Is it a standard? Eric - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Newbie in.help needed..(basics)
> Has anybody had any experience with wrapping log4j? Yes, but not for isolation. Rather, I needed a custom hierarchy and category, so I was already there. The config side is straight log4j. > > Is the 1.1beta stable enought for development? > I haven't had any problems going on a month or so. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Newbie in.help needed..(basics)
Rob , Thanks for your quick response. Has anybody had any experience with wrapping log4j? Is the 1.1beta stable enought for development? Ralf -Original Message- From: Rob Walker To: LOG4J Users Mailing List Sent: 2001-04-11 18:04 Subject: Re: Newbie in.help needed..(basics) Ralf We chose not to got the wrapper route. After investigation we decided it was unlikely to improve performance or encapsulation, and would almost certainly result in larger code changes rather than smaller ones. So afraid I can't help on experiences of writing log4j wrappers. -- Rob SoftSell Business Systems, Ltd. ' testing solutions for a changing world ' +44 (20) 7488 3470 www.softsell.com [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]
RE: Convenience overloads in Category
What is i18n? I have seen it referenced a couple times. Is it a standard? Eric -Original Message- From: Johnson, Clay [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 11, 2001 10:29 AM To: 'LOG4J Users Mailing List' Subject: RE: Convenience overloads in Category That violates i18n. I'd discourage it. > -Original Message- > From: Michael McKibben [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, April 11, 2001 2:47 AM > To: [EMAIL PROTECTED] > Subject: Convenience overloads in Category > > > Hi, I was wondering if the following method overloads in > Category might be > useful to help ease the burden associated with logXXX() parameter > construction. Currently, there are two convenience overloads > per priority, > e.g. > > void info(Object message); > void info(Object message, Throwable); > > What I find myself doing a lot in my code is something similar to the > following: > > category.info("message: " + variable + " is not found"); > > What if a few extra overloads were added to account for > multiple message > parameters, e.g > > void info(Object message1, Object message2); > void info(Object message1, Object message2, Object message3); > > Then the user code would be simplified to: > > category.info("message: ", variable, " is not found"); > > The nice thing is that for the common cases of 1-3 > parameters, the "hidden" > StringBuffer goes away. The overloaded methods inside > Category could reuse a > common StringBuffer for string concatenation. Plus, you may > feel less need > to wrap your log statements with "category.isInfoEnabled()" > if statements. > > Also, for support for more than three message concatenations, or as an > alternative to the above idea, an Object[] could be passed to the one > argument method, and a special renderer could be called upon > to deal with > arrays. For example: > > category.info(new Object[]{"message", variable, "is not > found.", "..."}); > > Would be handled by a default ObjectRenderer similar to: > > String doRender(Object o) { > String message; > Object[] messages = (Object[])o; > myStringBuffer.setLength(0); > for (int i=0; i o = messages[i]; > message = (o instanceof String)? > (String)message : > myRendererMap.findAndRender(o); > myStringBuffer.append(message); > } > return myStringBuffer.toString(); > } > > Is all this more trouble than it's worth? I suppose Category > could be also > extended to add this behavior as well, but then configuration > gets a little > tricky. Thoughts? > > --mike > > > > - > 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]
Re: Newbie in.help needed..(basics)
Ralf We chose not to got the wrapper route. After investigation we decided it was unlikely to improve performance or encapsulation, and would almost certainly result in larger code changes rather than smaller ones. So afraid I can't help on experiences of writing log4j wrappers. -- Rob SoftSell Business Systems, Ltd. ' testing solutions for a changing world ' +44 (20) 7488 3470 www.softsell.com [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Newbie in.help needed..(basics)
> Rob Walker wrote: >When we looked at wrapper classes we realised that any we >produced would degrade performance, and imply significantly >larger changes to our classes. So wrappers won't necessarily >make the transition simpler. I've been looking at such a wrapper. Could you please give an exmple how such a wrapper might look and how you could call that wrapper fom you code? Could you elaborate more on your experience with wrappers (performance , imply significantly larger changes to our classes)? Thank you. Ralf - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Convenience overloads in Category
That violates i18n. I'd discourage it. > -Original Message- > From: Michael McKibben [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, April 11, 2001 2:47 AM > To: [EMAIL PROTECTED] > Subject: Convenience overloads in Category > > > Hi, I was wondering if the following method overloads in > Category might be > useful to help ease the burden associated with logXXX() parameter > construction. Currently, there are two convenience overloads > per priority, > e.g. > > void info(Object message); > void info(Object message, Throwable); > > What I find myself doing a lot in my code is something similar to the > following: > > category.info("message: " + variable + " is not found"); > > What if a few extra overloads were added to account for > multiple message > parameters, e.g > > void info(Object message1, Object message2); > void info(Object message1, Object message2, Object message3); > > Then the user code would be simplified to: > > category.info("message: ", variable, " is not found"); > > The nice thing is that for the common cases of 1-3 > parameters, the "hidden" > StringBuffer goes away. The overloaded methods inside > Category could reuse a > common StringBuffer for string concatenation. Plus, you may > feel less need > to wrap your log statements with "category.isInfoEnabled()" > if statements. > > Also, for support for more than three message concatenations, or as an > alternative to the above idea, an Object[] could be passed to the one > argument method, and a special renderer could be called upon > to deal with > arrays. For example: > > category.info(new Object[]{"message", variable, "is not > found.", "..."}); > > Would be handled by a default ObjectRenderer similar to: > > String doRender(Object o) { > String message; > Object[] messages = (Object[])o; > myStringBuffer.setLength(0); > for (int i=0; i o = messages[i]; > message = (o instanceof String)? > (String)message : > myRendererMap.findAndRender(o); > myStringBuffer.append(message); > } > return myStringBuffer.toString(); > } > > Is all this more trouble than it's worth? I suppose Category > could be also > extended to add this behavior as well, but then configuration > gets a little > tricky. Thoughts? > > --mike > > > > - > 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: help with Wrapping/Buffering
Take a look at SMTPAppender. It uses a cyclic buffer and trigger event to flush. It sends email, but it should be easy to modify that. > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, April 11, 2001 4:24 AM > To: [EMAIL PROTECTED] > Subject: Re: help with Wrapping/Buffering > > > > Hi Scott, > I'm not sure you completely understood my problem (or perhaps > I didn't understand your answer!) > I'll try to restate the issue again. > > In order to avoid having huge log files full of unneeded > information, I am going to store the log items for a session > in a buffer. The items in this buffer may be discarded if > there are no problems, but if there is an error, I'd like to > output the contents of the buffer to a file. > > My problem is that if I handle the buffering before even > touching log4j, then later pass the contents of the buffer > through log4j I will not be able to retrospectively work out > %F,%L etc. My plan was to find this information and add it to > the buffer myself. > > After sleeping on the problem, I have thought of a second > possibility, and would be interested to hear if anything like > this has been done before: > > I was thinking about having some sort of BufferAppender which > could add the LoggingEvents to an array/vector then some > trigger could be used to output this information to a file > when necessary. One downside I can see with this is that if > I've specified the BufferAppender as the appender for a > category, I will lose the ability to specify where the > information is passed after the buffer. > > Well, I've successfully managed to confuse myself. If anyone > understands my problem, and can suggest a solution then > please let me know. > > Thanks, > > Ross > > > -- > >From: "SCOTT FARQUHAR" <[EMAIL PROTECTED]> > >To: <[EMAIL PROTECTED]> > >Subject: Re: help with Wrapping/Buffering > >Date: Wed, 11 Apr 2001 09:40:13 +1000 > > > >Wouldn't it be better to write your own Configurator to turn > log4j logging >on and off when necessary? Surely you could > write it so that it would cate>r for whatever business logic > you need.. > > > > > >Scott > > > [EMAIL PROTECTED] 04/10/01 08:19pm >>> > >Hi there, > >I've just started using log4j (and am still a newbie to java > itself).I am u>sing a wrapper class around log4j, and part of > what my wrapper does is to b>uffer log items, only sending > them to log4j when certain events occur. Clea>rly by doing > this, I lose log4j's ability to automatically retrieve > methods>, line numbers etc. from the caller. > > > >It seems like what I have to do is to retrieve this > information before I ad>d an individual log to the buffer, > then send it as part of the message stri>ng to log4j. > Obviously I would lose some flexibility in the PatternLayout > f>unction, but this is not crucial. > > > >I understand that log4j somehow gets this information from a > stack trace, b>ut I am unsure of exactly how this works, or > how I would go about getting t>he information for myself. > > > >Thanks in advance for any help, > > > >Ross Ovland > > > >- > >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]
Re: help with Wrapping/Buffering
Hi Scott, I'm not sure you completely understood my problem (or perhaps I didn't understand your answer!) I'll try to restate the issue again. In order to avoid having huge log files full of unneeded information, I am going to store the log items for a session in a buffer. The items in this buffer may be discarded if there are no problems, but if there is an error, I'd like to output the contents of the buffer to a file. My problem is that if I handle the buffering before even touching log4j, then later pass the contents of the buffer through log4j I will not be able to retrospectively work out %F,%L etc. My plan was to find this information and add it to the buffer myself. After sleeping on the problem, I have thought of a second possibility, and would be interested to hear if anything like this has been done before: I was thinking about having some sort of BufferAppender which could add the LoggingEvents to an array/vector then some trigger could be used to output this information to a file when necessary. One downside I can see with this is that if I've specified the BufferAppender as the appender for a category, I will lose the ability to specify where the information is passed after the buffer. Well, I've successfully managed to confuse myself. If anyone understands my problem, and can suggest a solution then please let me know. Thanks, Ross -- >From: "SCOTT FARQUHAR" <[EMAIL PROTECTED]> >To: <[EMAIL PROTECTED]> >Subject: Re: help with Wrapping/Buffering >Date: Wed, 11 Apr 2001 09:40:13 +1000 > >Wouldn't it be better to write your own Configurator to turn log4j logging >on and >off when necessary? Surely you could write it so that it would cate>r for whatever >business logic you need.. > > >Scott > [EMAIL PROTECTED] 04/10/01 08:19pm >>> >Hi there, >I've just started using log4j (and am still a newbie to java itself).I am u>sing a >wrapper class around log4j, and part of what my wrapper does is to b>uffer log items, >only sending them to log4j when certain events occur. Clea>rly by doing this, I lose >log4j's ability to automatically retrieve methods>, line numbers etc. from the caller. > >It seems like what I have to do is to retrieve this information before I ad>d an >individual log to the buffer, then send it as part of the message stri>ng to log4j. >Obviously I would lose some flexibility in the PatternLayout f>unction, but this is >not crucial. > >I understand that log4j somehow gets this information from a stack trace, b>ut I am >unsure of exactly how this works, or how I would go about getting t>he information >for myself. > >Thanks in advance for any help, > >Ross Ovland > >- >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]
About the debug method of class Category.
Dear all, I try to log a message with debug method I pass the message and throwable to it. I find that I cannot read back the throwable in server side. It returns a null object to me. How can I read it back in ServerSide? Betty Pang - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Convenience overloads in Category
Hi, I was wondering if the following method overloads in Category might be useful to help ease the burden associated with logXXX() parameter construction. Currently, there are two convenience overloads per priority, e.g. void info(Object message); void info(Object message, Throwable); What I find myself doing a lot in my code is something similar to the following: category.info("message: " + variable + " is not found"); What if a few extra overloads were added to account for multiple message parameters, e.g void info(Object message1, Object message2); void info(Object message1, Object message2, Object message3); Then the user code would be simplified to: category.info("message: ", variable, " is not found"); The nice thing is that for the common cases of 1-3 parameters, the "hidden" StringBuffer goes away. The overloaded methods inside Category could reuse a common StringBuffer for string concatenation. Plus, you may feel less need to wrap your log statements with "category.isInfoEnabled()" if statements. Also, for support for more than three message concatenations, or as an alternative to the above idea, an Object[] could be passed to the one argument method, and a special renderer could be called upon to deal with arrays. For example: category.info(new Object[]{"message", variable, "is not found.", "..."}); Would be handled by a default ObjectRenderer similar to: String doRender(Object o) { String message; Object[] messages = (Object[])o; myStringBuffer.setLength(0); for (int i=0; i