RE: How configure the categories for console, logFile and htmlFile showing different levels
Dear Jacob, Thanks for your comments, I have addes this new features on Bugzilla: http://issues.apache.org/bugzilla/show_bug.cgi?id=40532 About your suggestions, I have a general idea about what you mean in order to specify the oposite situation (so, limit my classes and for others external libraries apply a default policy: warn level), the problem is that I am not Log4j expert and it works for me right now, with more configuration effort, :-( Please could you try to expose those changes on my original log4j.xml file? Thanks a lot, David I am going to add this new feature on Bugzila Jacob Kjome <[EMAIL PROTECTED]> wrote: At 07:19 PM 9/17/2006, you wrote: >Dear Bender, > >Thanks four your xml sample now it works as I >expect, on the attached file you will find it. > >Nevertheless I have some comments, I am not >log4j expert, but I guess the syntax could be >simplified, and probably it is possible: > >1. With your suggestion, I have to specify >explicit each external library, but the opossite >would be easier to define, but I don't know how >to set it, all my classes belong to the package: >com.schinvest, so this package will be at INFO >level for console, file, and htmlFile, any thing >else will have WARNING level for all appenders. >Probably this could be configurate in simpler >way, but I don't know how to do it. > >2. On cathegory node there is no way on the >class attribute to specify more than one class at the same time, is that true? > > > > > > > >so this cathegory will be applied for org.* and >net.sf.* packages, that would simplify the log4 >configuration, but I have tested it and it doesn't work. > First, you should be using , not . And it's , not Otherwise, Interesting idea. It won't work and I doubt very much that this will be added to Log4j-1.2.xx, but it might be something for later versions. You could post an enhancement report in bugzilla. Your only real chance to get this behavior currently is to set everything in the logger. In fact, I usually set most everything in the logger and only define other loggers if I want behavior in any way different than what I set in the logger. Also, I usually set the logger to value="warn"/> and specify a lower level only when I truly need it. Below is how I would envision your config file. I think you'll find it 100% more manageable. By defaulting to a higher level "warn" in , you can then make an exception for your own organization's package instead of having to exhaustively account for all the external packages your application uses. Generalize the unknown (external library config) and specify the known (your organization's config) xmlns:log4j="http://jakarta.apache.org/log4j/"; debug="false"> class="org.apache.log4j.ConsoleAppender"> value="%5p%x[%M](%C{1}:%L) - %m%n"/> class="org.apache.log4j.DailyRollingFileAppender"> value="[%d{-MM-dd hh:mm:ss},%6.6r]%5p%x[%M](%C{1}:%L) - %m%n"/> class="org.apache.log4j.DailyRollingFileAppender"> Jake >Thanks for your help, > >David > >Bender Heri wrote: >Here is an example of an xml configuration which >uses filters (BTW: Using this two appenders when >debugging in eclipse the console shows the DEBUG >and INFO in black color and the others in red >color). You can also write your own filter class >where you are free to filter what you want. Be >careful on the ordering when extending this xml >file. The logj4 parser expects first all appenders followed by all loggers. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >Yahoo! Messenger with Voice. >Make >PC-to-Phone Calls to the US (and 30+ countries) for 2¢/min or less. > > > >>This configuration defines three appenders: >console: With warn level >file: With debug level four all classes except for external libraries of > our application. >htmlFile: With the same configuration as console, except for HTML format. >--> > >>xmlns:log4j="http://jakarta.apache.org/log4j/"; debug="false"> > > > class="org.apache.log4j.ConsoleAppender"> > > > > > value="%5p%x[%M](%C{1}:%L) - %m%n"/> > > > > > > > > > > class="org.apache.log4j.DailyRollingFileAppender"> > > > > > > > value="[%d{-MM-dd > hh:mm:ss},%6.6r]%5p%x[%M](%C{1}:%L) - %m%n"/> > > > > > > > > > > class="org.apache.log4j.DailyRollingFileAppender"> > > > > > > > > > > > > > > > > main pattern on the name attribute > Note: You can't concatenate the class names on one category, for example: > putting in the name="org, net.sf" together.--> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] -
Enhanced FileAppender (Was: Separate log files per thread.)
This problem arises often. Some want to separate the log files of servlets by different criterias (sessionID, userID, etc.), others (like me) have a scheduler which fires different tasks on different customers where the log output should be separated. I thought one could enhance the file appender itself by suppliying it with a kind of FileNameBuilder-Class. So this enhancement would apply to all descendants of file appender (Rolling, DailyRolling, etc.). The FileNameBuilder could build the filename by using values of MDC or any other criterias, and the file appender can then hold a bundle of different targets, like described below by Curt Arnold. In my opinion this would be more flexible than a hard coded pattern which just relys on the thread name. Any thoughts? Heri > -Original Message- > From: Curt Arnold [mailto:[EMAIL PROTECTED] > Sent: Friday, September 15, 2006 6:19 PM > To: Log4J Users List > Subject: [SPAM (Bayesain Analysis)] - Re: Separate log files > per thread. > - Bayesian Filter detected spam > > > > On Sep 14, 2006, at 4:11 PM, James Stauffer wrote: > > > 4. Write your own appender that potentially changes the logfile name > > per logging event. I do a smiliar thing with an appender. > > http://stauffer.james.googlepages.com/DateFormatFileAppender.java > > > > > 5. Discuss the requirements for such an appender on the mailing list > and see if a consensus could be formed. If so, a sandbox project > could be started to develop the appender and when functional > it might > get added into log4j itself. You also might check if log4net might > already have something similar and if so, we might port it back from > there. > > I thought about it a little. It was thinking that you might specify > a java.text.MessageFormat pattern for file name using Thread.getName > () (or Thread.toString() if name was blank), the maximum number of > open files, plus the WriterAppender properties. The appender would > keep a hashmap of Writers keyed by the generated file name and would > maintain it so it closed the stalest Writer if the open file count > would have been exceeded. > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Confusion: Late 1.3 release, SLF4J, LogBack, etc
Hi *, I need some light shed on this... What should a user do nowadays? - I have seen comments about slf4j, is it an "official" or recommended way to do things? Will the Apache Log4J "comply" to the facade or at least work with the writers of slf4j? - release 1.3 promises a lot of goodies, should I wait? or use an existing alternative? - LogBack claims to be a candidate replacement for Log4J and although I agree that Log4J needs to evolve (jdk 5 features please), I am very worried about a split or yet another way to do things. I am not willing to risk my systems with an untested logging mechanism but I shall keep my eyes open. I do not know the issue(s) behind what looks like the split from Log4J by Cedik but this both brings weight and extra risk to LogBack (lack of traction, dependency on one or little more individuals) I have seen a recent roadmap but we need some more precise deadlines... By the way the links to javadoc on the website are both the same for 1.2.13 and 1.3-alph8, this is not correct: http://logging.apache.org/log4j/docs/documentation.html Thanks Benoit -- View this message in context: http://www.nabble.com/Confusion%3A-Late-1.3-release%2C-SLF4J%2C-LogBack%2C-etc-tf2290721.html#a6361996 Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
how to define my own log file name
Hi all, I want to define the log file name pattern like mmdd-mylog.log, how to do so using log4j? As the DailyRollingFileAppender is just append the yyymmdd pattern to the end of the file name, something like mylog.log.mmdd. Do I need to write my own appender class, or can anyone provide some helpful util class? Thanks for help!
Re: how to define my own log file name
Hi, A good approach as you said, would be to extend the appender you need. Regards, Norbert On 9/18/06, kingwell <[EMAIL PROTECTED]> wrote: Hi all, I want to define the log file name pattern like mmdd-mylog.log, how to do so using log4j? As the DailyRollingFileAppender is just append the yyymmdd pattern to the end of the file name, something like mylog.log.mmdd. Do I need to write my own appender class, or can anyone provide some helpful util class? Thanks for help!
How to filter specific characters to not to log
Hi, I want to filter some specific characters (special chars) , so that it should not log. Can anyone suggest me how to it? Thanks, Praveen
Re: How to filter specific characters to not to log
Can you explain where these characters occur? Are they within a String supplied as msg argument in log calls? Or where? Heri > -Original Message- > From: Praveen Kumar Hasthalapuram [mailto:[EMAIL PROTECTED] > Sent: Monday, September 18, 2006 4:02 PM > To: log4j-user@logging.apache.org > Subject: [SPAM (Bayesain Analysis)] - How to filter specific > characters > to not to log - Bayesian Filter detected spam > > > Hi, > > I want to filter some specific characters (special chars) , so that it > should not log. > > Can anyone suggest me how to it? > > Thanks, > Praveen > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Confusion: Late 1.3 release, SLF4J, LogBack, etc
On Sep 18, 2006, at 6:31 AM, Benoitx wrote: Hi *, I need some light shed on this... What should a user do nowadays? - I have seen comments about slf4j, is it an "official" or recommended way to do things? If you want to be able to select at configuration time between the supported logging implementations (log4j, JDK 1.4 logging, et al), it is a way to accomplish that. Jakarta Commons Logging (JCL) addresses the same need. SLF4J was started to provide an alternative to JCL to address some problems due to JCL attempting to select the implementation depending on what classes were available on the classpath (see http://www.qos.ch/logging/thinkAgain.jsp) and concerns that the Apache License was considered too restrictive (SLF4J is an X11 license). The logging API's in JCL and SLF4J are similar to log4j both log4j-like but with different package names. So switching most log statements from one to another can be done just by changing package names. If you are looking for "officialness" in a logging API, then the javax.util.logging classes (aka JSR-47 or JDK 1.4 logging) would seem to have that wrapped up. Will the Apache Log4J "comply" to the facade or at least work with the writers of slf4j? SLF4J.org provides an implementation of the SLF4J interfaces that delegates to log4j like it provides an implementation that delegates to JDK 1.4 logging. Given the license and code maturity considerations, having SLF4J provide a wrapper for log4j is preferable in my opinion than having log4j depend on SLF4J. - release 1.3 promises a lot of goodies, should I wait? or use an existing alternative? Sorry, not enough information to even start making that decision for you. You would need to know what JDK that you are targeting (JDK 1.4 logging might not be a candidate if you wanted to run on JDK 1.3, for example), feature needs, licensing concerns, and process concerns. - LogBack claims to be a candidate replacement for Log4J and although I agree that Log4J needs to evolve (jdk 5 features please), I am very worried about a split or yet another way to do things. I am not willing to risk my systems with an untested logging mechanism but I shall keep my eyes open. I do not know the issue(s) behind what looks like the split from Log4J by Cedik but this both brings weight and extra risk to LogBack (lack of traction, dependency on one or little more individuals) Ceki is a Logging Services PMC member and log4j committer. However, since the recalled log4j 1.2.10 release, he has limited his participation in the log4j community to participating in the mailing lists and has spent his efforts on the SLF4J, NLOG4J and logback projects. If you search the log4j-dev archives for 1.2.10, you should get an understanding of what has led to the current state. I have seen a recent roadmap but we need some more precise deadlines... By the way the links to javadoc on the website are both the same for 1.2.13 and 1.3-alph8, this is not correct: http://logging.apache.org/log4j/docs/documentation.html It has been reported as a bug and I expect to fix it when the site is updated for log4j 1.2.14. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How configure the categories for console, logFile and htmlFile showing different levels
Quoting David <[EMAIL PROTECTED]>: > Dear Jacob, > > Thanks for your comments, I have addes this new features on Bugzilla: > > http://issues.apache.org/bugzilla/show_bug.cgi?id=40532 > Like I said, I doubt this will get into Log4j-1.2.xx unless you provide a patch that doesn't break existing functionality. It may be possible for future versions, but I wouldn't hold my breath unless you or someone else provides a patch implementing the feature. > About your suggestions, I have a general idea about what you mean in order > to specify the oposite situation (so, limit my classes and for others > external libraries apply a default policy: warn level), the problem is that I > am not Log4j expert and it works for me right now, with more configuration > effort, :-( > > Please could you try to expose those changes on my original log4j.xml file? > Well no, because the changes I provided already address everything you want to do. Try it. Logging behavior should be identical, other than the fact that your original file would suffer from duplicate log messages because you redefine appenders in each of the external libraries. That's called "additivity". So, please try my version. It does exactly what you want as far as I can decifer from your original config file and fixes some of its bugs. Jake > Thanks a lot, > > David > > I am going to add this new feature on Bugzila > > Jacob Kjome <[EMAIL PROTECTED]> wrote: > At 07:19 PM 9/17/2006, you wrote: > >Dear Bender, > > > >Thanks four your xml sample now it works as I > >expect, on the attached file you will find it. > > > >Nevertheless I have some comments, I am not > >log4j expert, but I guess the syntax could be > >simplified, and probably it is possible: > > > >1. With your suggestion, I have to specify > >explicit each external library, but the opossite > >would be easier to define, but I don't know how > >to set it, all my classes belong to the package: > >com.schinvest, so this package will be at INFO > >level for console, file, and htmlFile, any thing > >else will have WARNING level for all appenders. > >Probably this could be configurate in simpler > >way, but I don't know how to do it. > > > >2. On cathegory node there is no way on the > >class attribute to specify more than one class at the same time, is that > true? > > > > > > > > > > > > > > > >so this cathegory will be applied for org.* and > >net.sf.* packages, that would simplify the log4 > >configuration, but I have tested it and it doesn't work. > > > > First, you should be using , not > . And it's , not > > Otherwise, Interesting idea. It won't work and I > doubt very much that this will be added to > Log4j-1.2.xx, but it might be something for later > versions. You could post an enhancement report in bugzilla. > > Your only real chance to get this behavior > currently is to set everything in the > logger. In fact, I usually set most everything > in the logger and only define other > loggers if I want behavior in any way different > than what I set in the logger. Also, I > usually set the logger to value="warn"/> and specify a lower level only when > I truly need it. > > Below is how I would envision your config > file. I think you'll find it 100% more > manageable. By defaulting to a higher level > "warn" in , you can then make an exception > for your own organization's package instead of > having to exhaustively account for all the > external packages your application > uses. Generalize the unknown (external library > config) and specify the known (your organization's config) > > > > > xmlns:log4j="http://jakarta.apache.org/log4j/"; debug="false"> > > class="org.apache.log4j.ConsoleAppender"> > > > > > > > value="%5p%x[%M](%C{1}:%L) - %m%n"/> > > > > > > > > > > > > class="org.apache.log4j.DailyRollingFileAppender"> > > > > > > > > > > value="[%d{-MM-dd > hh:mm:ss},%6.6r]%5p%x[%M](%C{1}:%L) - %m%n"/> > > > > > > > > > > > > class="org.apache.log4j.DailyRollingFileAppender"> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Jake > > > >Thanks for your help, > > > >David > > > >Bender Heri wrote: > >Here is an example of an xml configuration which > >uses filters (BTW: Using this two appenders when > >debugging in eclipse the console shows the DEBUG > >and INFO in black color and the others in red > >color). You can also write your own filter class > >where you are free to filter what you want. Be > >careful on the ordering when extending this xml > >file. The logj4 parser expects first all appenders followed by all loggers. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >Yahoo! Messenger with Voice. > >Make > >PC-to-Phone Calls to the US (and 30+ countries) for 2¢/min or less. > > > > > > > >>This configuration defines three appenders: > >console: With warn level > >file: With debug level four all classes except for external libra
Re: setRepositorySelector, guard and redeploy
Quoting jan_bar <[EMAIL PROTECTED]>: > Thanks for your extensive answer, see inline.. > > > Well, when you are using a repository selector, the idea is that you > > have Log4j in a position where it is not part of your app, but part > > of the server; otherwise there's no point to using a repository > > selector. In order for a server wide instance of Log4j to service > > many apps without each of them stomping on each other's logging, each > > app needs to be assigned its own logger repository. On the other > > hand, if you deploy your app with Log4j in WEB-INF/lib (and use > > child-first classloading behavior), you can just use the default > > logger repository since your app will be the only one utilizing the > > instance of Log4j. > > I know about this possibility and also it's classloading order fragility. I > want to avoid this. > Don't we all. But in order to do so, we must take the necessary steps to get the custom repository selector and log4j.jar in the same classloader that is a parent of any specific application classloader. > > The solution is to deploy your custom repository selector alongside > > the global instance of Log4j, not with your app. And if you have > > access to the JBoss startup script, you can set the -D property to > > set the repository selector when JBoss starts up (sorry, can't recall > > the system property name to set ATM). > > How can I set the repository selector of JBoss startup? Is the mentioned > property used in Log4j init or inside JBoss? I looked into sources of both, > but did not found any call to LogManager.setRepositorySelector(). > My memory slightly failed me. The system property I referred to does exist, but only in Log4j-1.3alpha. You'd use either... -Dlog4j.repositorySelector=JNDI OR -Dlog4j.repositorySelector=fully.qualified.ClassName The "JNDI" value corresponds to the new org.apache.log4j.selector.ContextJNDISelector that is part of Log4j-1.3alpha, but does *not* exist in Log4j-1.2.xx. So, if you want to use this feature, you'll have to use Log4j-1.3. I would build from source if you do, because a lot has changed since the last release. A new release should be out pretty soon based on what some of the other Log4j committers have stated. Can't promise any specific date, though. > I found org.jboss.portal.common.logging.LoaderRepositorySelector, which > looks exactly as something I miss in JBoss AS. It's part of the JBoss > Portal. > So, the portal sets its own repository selector. Not sure where, but since the portal pretty much is the server to all the other portlet applications that get deployed under it, it would make sense to do it at that level. For JBoss AS, you can write a server startup class (most servers provide a proprietary API for startup classes that the server will call as configured) and set your preferred repository selector inside that. Any app deployed under that server will log to the appropriate logger repository provided by the configured repository selector. Jake > Thanks, Jan > > > > > - > 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: setRepositorySelector, guard and redeploy
Thank you Jake for your help. My options are now clear. Jan "Jacob Kjome" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Quoting jan_bar <[EMAIL PROTECTED]>: > > > Thanks for your extensive answer, see inline.. > > > > > Well, when you are using a repository selector, the idea is that you > > > have Log4j in a position where it is not part of your app, but part > > > of the server; otherwise there's no point to using a repository > > > selector. In order for a server wide instance of Log4j to service > > > many apps without each of them stomping on each other's logging, each > > > app needs to be assigned its own logger repository. On the other > > > hand, if you deploy your app with Log4j in WEB-INF/lib (and use > > > child-first classloading behavior), you can just use the default > > > logger repository since your app will be the only one utilizing the > > > instance of Log4j. > > > > I know about this possibility and also it's classloading order fragility. I > > want to avoid this. > > > > Don't we all. But in order to do so, we must take the necessary steps to get > the custom repository selector and log4j.jar in the same classloader that is a > parent of any specific application classloader. > > > > The solution is to deploy your custom repository selector alongside > > > the global instance of Log4j, not with your app. And if you have > > > access to the JBoss startup script, you can set the -D property to > > > set the repository selector when JBoss starts up (sorry, can't recall > > > the system property name to set ATM). > > > > How can I set the repository selector of JBoss startup? Is the mentioned > > property used in Log4j init or inside JBoss? I looked into sources of both, > > but did not found any call to LogManager.setRepositorySelector(). > > > > My memory slightly failed me. The system property I referred to does exist, but > only in Log4j-1.3alpha. You'd use either... > > -Dlog4j.repositorySelector=JNDI > OR > -Dlog4j.repositorySelector=fully.qualified.ClassName > > The "JNDI" value corresponds to the new > org.apache.log4j.selector.ContextJNDISelector that is part of Log4j-1.3alpha, > but does *not* exist in Log4j-1.2.xx. So, if you want to use this feature, > you'll have to use Log4j-1.3. I would build from source if you do, because a > lot has changed since the last release. A new release should be out pretty > soon based on what some of the other Log4j committers have stated. Can't > promise any specific date, though. > > > I found org.jboss.portal.common.logging.LoaderRepositorySelector, which > > looks exactly as something I miss in JBoss AS. It's part of the JBoss > > Portal. > > > > So, the portal sets its own repository selector. Not sure where, but since the > portal pretty much is the server to all the other portlet applications that get > deployed under it, it would make sense to do it at that level. For JBoss AS, > you can write a server startup class (most servers provide a proprietary API > for startup classes that the server will call as configured) and set your > preferred repository selector inside that. Any app deployed under that server > will log to the appropriate logger repository provided by the configured > repository selector. > > Jake > > > Thanks, Jan > > > > > > > > > > - > > 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: How to filter specific characters to not to log
Hi, We will get these characters from the devices and these data we will log. These logged data will be used to generate xml reports. With some devices we are getting some control characters (some spl symbols) and these are causing xml report to fail. Is it possible to strip this characters or filter this types of characters. Regards, Praveen On 9/18/06, Bender Heri <[EMAIL PROTECTED]> wrote: Can you explain where these characters occur? Are they within a String supplied as msg argument in log calls? Or where? Heri > -Original Message- > From: Praveen Kumar Hasthalapuram [mailto:[EMAIL PROTECTED] > Sent: Monday, September 18, 2006 4:02 PM > To: log4j-user@logging.apache.org > Subject: [SPAM (Bayesain Analysis)] - How to filter specific > characters > to not to log - Bayesian Filter detected spam > > > Hi, > > I want to filter some specific characters (special chars) , so that it > should not log. > > Can anyone suggest me how to it? > > Thanks, > Praveen > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
log4j doesn't log files when weblogic is run as a windows service.
All, The log4j framework doesn't seem to write to the logs when weblogic is run as windows service. As I understand, the two things needed for the log4j framework are: - log4j.jar in classpath - log4j.properties as -Dlog4j.configuration. It contains the necessary configuration for logging. Both of the above mentioned artifacts are found correctly configured in the utilities that were used to create the windows service. I have used both bea provided utility and Java Service Wrapper from Tanuki Software. When weblogic is started after the service installation, log files that were supposed to be created by log4j don't appear. The ironic part is that when weblogic is started manually, the log files do appear. Is there a known workaround for this scenario? I appreciate any help. Environment info: OS - Windows 2000 server JDK - 1.4.2 Weblogic - 8.1 log4j - 1.2.7 Thanks, Abbas
Re: log4j doesn't log files when weblogic is run as a windows service.
I'll bet they *do* get created. You just don't know where to look. What does your config look like? Does it use relative paths to the files? Keep in mind, relative paths are relative to the directory from which the JVM started. So, if you start on the command line, the path in the config file is relative to the current directory in the command shell. OTOH, When you start up using a service, unless you define the startup directory, it will default to "C:\WINDOWS\system32" (or the equivalent on your windows box). Furthermore, if your path includes a directory name, such as "./logs/mylog.log", and said directory doesn't exist already under "C:\WINDOWS\system32", then Log4j won't bother creating it for you. You have to make sure it exists before Log4j can write to the location. Look into that and let us know what you find. Jake Quoting Mirza Abbas Raza <[EMAIL PROTECTED]>: > All, > > The log4j framework doesn't seem to write to the logs when weblogic is run as > windows service. As I understand, the two things needed for the log4j > framework are: > - log4j.jar in classpath > - log4j.properties as -Dlog4j.configuration. It contains the necessary > configuration for logging. > > Both of the above mentioned artifacts are found correctly configured in the > utilities that were used to create the windows service. I have used both bea > provided utility and Java Service Wrapper from Tanuki Software. When weblogic > is started after the service installation, log files that were supposed to be > created by log4j don't appear. The ironic part is that when weblogic is > started manually, the log files do appear. Is there a known workaround for > this scenario? I appreciate any help. > > Environment info: > OS - Windows 2000 server > JDK - 1.4.2 > Weblogic - 8.1 > log4j - 1.2.7 > > Thanks, > Abbas > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: log4j doesn't log files when weblogic is run as a windows service.
Hi Jake, First of all, thanks so much for your reply. I appreciate it. I am checking if the logs are getting created in the default directory. I will come back to you on this. - Abbas - Original Message From: Jacob Kjome <[EMAIL PROTECTED]> To: Log4J Users List ; Mirza Abbas Raza <[EMAIL PROTECTED]> Sent: Monday, September 18, 2006 11:57:20 AM Subject: Re: log4j doesn't log files when weblogic is run as a windows service. I'll bet they *do* get created. You just don't know where to look. What does your config look like? Does it use relative paths to the files? Keep in mind, relative paths are relative to the directory from which the JVM started. So, if you start on the command line, the path in the config file is relative to the current directory in the command shell. OTOH, When you start up using a service, unless you define the startup directory, it will default to "C:\WINDOWS\system32" (or the equivalent on your windows box). Furthermore, if your path includes a directory name, such as "./logs/mylog.log", and said directory doesn't exist already under "C:\WINDOWS\system32", then Log4j won't bother creating it for you. You have to make sure it exists before Log4j can write to the location. Look into that and let us know what you find. Jake Quoting Mirza Abbas Raza <[EMAIL PROTECTED]>: > All, > > The log4j framework doesn't seem to write to the logs when weblogic is run as > windows service. As I understand, the two things needed for the log4j > framework are: > - log4j.jar in classpath > - log4j.properties as -Dlog4j.configuration. It contains the necessary > configuration for logging. > > Both of the above mentioned artifacts are found correctly configured in the > utilities that were used to create the windows service. I have used both bea > provided utility and Java Service Wrapper from Tanuki Software. When weblogic > is started after the service installation, log files that were supposed to be > created by log4j don't appear. The ironic part is that when weblogic is > started manually, the log files do appear. Is there a known workaround for > this scenario? I appreciate any help. > > Environment info: > OS - Windows 2000 server > JDK - 1.4.2 > Weblogic - 8.1 > log4j - 1.2.7 > > Thanks, > Abbas > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to filter specific characters to not to log
XMLLayout in both 1.2 and 1.3 can produce "bad" XML in several scenarios as reported in bugs 29244, 34875 and 37560. Since I was an XML guru in a former life, I know of additional holes in the implementation. If you'd be interested in testing it, I could take a shot at re-implementing XMLLayout. I think that would be a better solution than trying to filter content to avoid the bugs. On Sep 18, 2006, at 1:09 PM, Praveen Kumar Hasthalapuram wrote: Hi, We will get these characters from the devices and these data we will log. These logged data will be used to generate xml reports. With some devices we are getting some control characters (some spl symbols) and these are causing xml report to fail. Is it possible to strip this characters or filter this types of characters. Regards, Praveen - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: log4j doesn't log files when weblogic is run as a windows service.
A few quesions/comments... 1. What version of Log4j are you using? I think at some point, there was a feature implemented which allowed Log4j to create any needed directories. This hadn't been the case previously. I think it got implemented maybe post 1.2.9, but I'm not positive. So, it might make sense that the directories got created. 2. Clearly Weblogic's service is setting the startup directory if you find your directories being created under "mydomain". 3. Are you sure that log4j.properties is getting picked up? Is it possible some other config file is getting picked up? If log4j finds log4j.xml, it will be used in preference to log4j.properties. Also, try setting log4j.debug=true. Maybe you'll see some extra output. Add a console appender to make sure you see this output. It should turn up in Weblogic's console log file. Jake Quoting Mirza Abbas Raza <[EMAIL PROTECTED]>: > So, Jake, here is what I did but didn't succeed. > > Excerpt from log4j.properties file. > # Specify the R log file > log4j.appender.R=org.apache.log4j.DailyRollingFileAppender > log4j.appender.R.File=logs/node/mylog.log > log4j.appender.DAILY.DatePattern='.'-MM-dd > > Scenario 1: Run as is. > - checked C:\winnt\system32. > - obviously no logs found. > > Scenario 2: Created directories logs/node in C:\winnt\system32. > - stopped service and restarted. > - no logs found in C:\winnt\system32\logs\node directory. > > Scenario 3: Changed log4j.appender.R.File=logs/node/mylog.log to > D:\mydirectory\domains\mydomain/logs/node/mylog.log > - stopped and restarted service. > - no logs found in D:\mydirectory\domains\mydomain/logs/node/mylog.log. > > I couldn't find a way to specify the startup directory with the weblogic > utility or the Java Service Wrapper and hence couldn't test it. However, I > saw an interesting point in the properties for the service. > "D:\mydirectory\domains\mydomain\wrapper.exe -s > D:\mydirectory\domains\mydomain\conf\managedwrapper.conf". The logs/node > directory is located in mydomain directory. Wouldn't this point the logs to > the right directory? > > Thanks, > Abbas > > > - Original Message > From: Jacob Kjome <[EMAIL PROTECTED]> > To: Log4J Users List ; Mirza Abbas Raza > <[EMAIL PROTECTED]> > Sent: Monday, September 18, 2006 11:57:20 AM > Subject: Re: log4j doesn't log files when weblogic is run as a windows > service. > > > I'll bet they *do* get created. You just don't know where to look. What > does > your config look like? Does it use relative paths to the files? Keep in > mind, > relative paths are relative to the directory from which the JVM started. So, > if > you start on the command line, the path in the config file is relative to the > current directory in the command shell. > > OTOH, When you start up using a service, unless you define the startup > directory, it will default to "C:\WINDOWS\system32" (or the equivalent on > your > windows box). Furthermore, if your path includes a directory name, such as > "./logs/mylog.log", and said directory doesn't exist already under > "C:\WINDOWS\system32", then Log4j won't bother creating it for you. You have > to make sure it exists before Log4j can write to the location. > > Look into that and let us know what you find. > > Jake > > Quoting Mirza Abbas Raza <[EMAIL PROTECTED]>: > > > All, > > > > The log4j framework doesn't seem to write to the logs when weblogic is run > as > > windows service. As I understand, the two things needed for the log4j > > framework are: > > - log4j.jar in classpath > > - log4j.properties as -Dlog4j.configuration. It contains the necessary > > configuration for logging. > > > > Both of the above mentioned artifacts are found correctly configured in the > > utilities that were used to create the windows service. I have used both > bea > > provided utility and Java Service Wrapper from Tanuki Software. When > weblogic > > is started after the service installation, log files that were supposed to > be > > created by log4j don't appear. The ironic part is that when weblogic is > > started manually, the log files do appear. Is there a known workaround for > > this scenario? I appreciate any help. > > > > Environment info: > > OS - Windows 2000 server > > JDK - 1.4.2 > > Weblogic - 8.1 > > log4j - 1.2.7 > > > > Thanks, > > Abbas > > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
log4j 1.2.14 release
The Apache Logging Services project (http://logging.apache.org) is happy to announce the availability of log4j version 1.2.14. In this release, AsyncAppender was rewritten to eliminate reported deadlocks and to provide an option to not block if the event queue becomes full, SyslogAppender can now accept a port specification, and SMTPAppender supports cc and bcc addresses and password authentication. In addition, the following bugs were fixed: 40159: NullPointerException in org.apache.log4j.NDC.get. 36787: org.apache.log4j.lf5.util.DateFormatManager.setTimeZone assignment error. 38559: Monthly logs not generated at midnight with DailyRollingFileAppender. 40145: PatternLayout specifier %r is not consistent with documentation. 37119: Space after log level causes default level to be used. 39135: Bad patterns in ISO8601DateFormat and DateTimeDateFormat. 35743: SyslogAppender throws NullPointerException upon misconfiguration. 15501: FallbackErrorHandler throws NullPointerException if no loggers are set. 38564: Bad documentation for WriterAppender.encoding. 37866: NTEventLogAppender not build, tested and placed in distribution. 38662: SMTPAppender does not output newlines between stack trace lines. 30294: SMTPAppender will not run within sandbox. 16922: MDC with SMTPAppender doesn't work. 31507: Misspelling in HierarchyDynamicMBean. 35123: Additivity not exported by PropertyPrinter. 31003: RollingFileAppender, if removed, can cause NullPointerExceptions. 23021: AsyncAppender blocks on thread death. 40412: NOTICE file added to distribution and jar. 40378: Chainsaw of log4j 1.2 does not show TRACE level. 40501: TRACE level missing in short introduction to log4j. 37960: Update site generation to velocity 1.4 and remove dependency on logging/site project. It takes some time for the release to be distributed to all the mirror servers. At the moment it is known to be available on the devlib.org and uniontransit.com mirrors as well as the apache.org and eu.apache.org distribution servers. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]