log4j.xml validation
Hi, i am a bit puzzled on how i should do an apriori validation of a log4j.xml in log4j1.3 (without applying it to a LoggerRepository). can I still use the .dtd? but I am wondering whether the .dtd is still in sync with what is happening in the JoranConfigurator, e.g. if i remember well the .dtd still contains log4j:configuration, while the JoranConfigurator only accepts configuration. or should i use a temporary LoggerRepository, apply a configuration with the JoranConfigurator to it and check whether it returns any errors? cheers, dirk - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Configure two log4j loggers in one application
Hi all, could anybody give me hint to get Logger by appender? Best regards, Leon --- Leon Pu [EMAIL PROTECTED] wrote: Hi all, I have two log4j logger classes (own wrapper class to hide log4j for the customer class) in one application, and there are two xml configuration files for the two loggers. But I found that some time only one logger works, another logger's log writes to another logger. Since these two loggers are working in one JVM, is it mean that only one log4j logger is available in one JVM? Is it possible to merge the two xml configuration files to one? But how can I get the certain appender which I want to output? Best regards, Leon __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Configure two log4j loggers in one application
you can define as many loggers as you want within one configuration file / jvm. The same is true for appenders. And you are free to attach whatever appender to whatever logger. You even can attach the same appender to two or more different loggers. Your last question (get Logger by appender) I dont understand. What do you want achieve? Heri -Original Message- From: Leon Pu [mailto:[EMAIL PROTECTED] Sent: Monday, December 12, 2005 5:45 PM To: Log4J Users List Subject: Re: Configure two log4j loggers in one application Hi all, could anybody give me hint to get Logger by appender? Best regards, Leon --- Leon Pu [EMAIL PROTECTED] wrote: Hi all, I have two log4j logger classes (own wrapper class to hide log4j for the customer class) in one application, and there are two xml configuration files for the two loggers. But I found that some time only one logger works, another logger's log writes to another logger. Since these two loggers are working in one JVM, is it mean that only one log4j logger is available in one JVM? Is it possible to merge the two xml configuration files to one? But how can I get the certain appender which I want to output? Best regards, Leon __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Configure two log4j loggers in one application
Hi Bender, thank you for your reply. I have two services in one application, and I want to save the logs of two different services to different log files. For the different output file name, I have defined them under certain appender in xml configuration file. My question is how can I get the instance of org.apache.log4j.Logger which uses the certain appender in my xml configuration file? Best regards, Leon --- Bender Heri [EMAIL PROTECTED] wrote: you can define as many loggers as you want within one configuration file / jvm. The same is true for appenders. And you are free to attach whatever appender to whatever logger. You even can attach the same appender to two or more different loggers. Your last question (get Logger by appender) I dont understand. What do you want achieve? Heri -Original Message- From: Leon Pu [mailto:[EMAIL PROTECTED] Sent: Monday, December 12, 2005 5:45 PM To: Log4J Users List Subject: Re: Configure two log4j loggers in one application Hi all, could anybody give me hint to get Logger by appender? Best regards, Leon --- Leon Pu [EMAIL PROTECTED] wrote: Hi all, I have two log4j logger classes (own wrapper class to hide log4j for the customer class) in one application, and there are two xml configuration files for the two loggers. But I found that some time only one logger works, another logger's log writes to another logger. Since these two loggers are working in one JVM, is it mean that only one log4j logger is available in one JVM? Is it possible to merge the two xml configuration files to one? But how can I get the certain appender which I want to output? Best regards, Leon __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Configure two log4j loggers in one application
Do the two services run in different thread / thread-hierarchies? Heri -Original Message- From: Leon Pu [mailto:[EMAIL PROTECTED] Sent: Monday, December 12, 2005 6:02 PM To: Log4J Users List Subject: RE: Configure two log4j loggers in one application Hi Bender, thank you for your reply. I have two services in one application, and I want to save the logs of two different services to different log files. For the different output file name, I have defined them under certain appender in xml configuration file. My question is how can I get the instance of org.apache.log4j.Logger which uses the certain appender in my xml configuration file? Best regards, Leon --- Bender Heri [EMAIL PROTECTED] wrote: you can define as many loggers as you want within one configuration file / jvm. The same is true for appenders. And you are free to attach whatever appender to whatever logger. You even can attach the same appender to two or more different loggers. Your last question (get Logger by appender) I dont understand. What do you want achieve? Heri -Original Message- From: Leon Pu [mailto:[EMAIL PROTECTED] Sent: Monday, December 12, 2005 5:45 PM To: Log4J Users List Subject: Re: Configure two log4j loggers in one application Hi all, could anybody give me hint to get Logger by appender? Best regards, Leon --- Leon Pu [EMAIL PROTECTED] wrote: Hi all, I have two log4j logger classes (own wrapper class to hide log4j for the customer class) in one application, and there are two xml configuration files for the two loggers. But I found that some time only one logger works, another logger's log writes to another logger. Since these two loggers are working in one JVM, is it mean that only one log4j logger is available in one JVM? Is it possible to merge the two xml configuration files to one? But how can I get the certain appender which I want to output? Best regards, Leon __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Configure two log4j loggers in one application
Hi Heri, they are in two sub projects, and will be compiled to two jars. But will be deployed to one war. Best regards, Leon --- Bender Heri [EMAIL PROTECTED] wrote: Do the two services run in different thread / thread-hierarchies? Heri -Original Message- From: Leon Pu [mailto:[EMAIL PROTECTED] Sent: Monday, December 12, 2005 6:02 PM To: Log4J Users List Subject: RE: Configure two log4j loggers in one application Hi Bender, thank you for your reply. I have two services in one application, and I want to save the logs of two different services to different log files. For the different output file name, I have defined them under certain appender in xml configuration file. My question is how can I get the instance of org.apache.log4j.Logger which uses the certain appender in my xml configuration file? Best regards, Leon --- Bender Heri [EMAIL PROTECTED] wrote: you can define as many loggers as you want within one configuration file / jvm. The same is true for appenders. And you are free to attach whatever appender to whatever logger. You even can attach the same appender to two or more different loggers. Your last question (get Logger by appender) I dont understand. What do you want achieve? Heri -Original Message- From: Leon Pu [mailto:[EMAIL PROTECTED] Sent: Monday, December 12, 2005 5:45 PM To: Log4J Users List Subject: Re: Configure two log4j loggers in one application Hi all, could anybody give me hint to get Logger by appender? Best regards, Leon --- Leon Pu [EMAIL PROTECTED] wrote: Hi all, I have two log4j logger classes (own wrapper class to hide log4j for the customer class) in one application, and there are two xml configuration files for the two loggers. But I found that some time only one logger works, another logger's log writes to another logger. Since these two loggers are working in one JVM, is it mean that only one log4j logger is available in one JVM? Is it possible to merge the two xml configuration files to one? But how can I get the certain appender which I want to output? Best regards, Leon __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Configure two log4j loggers in one application
I never had to deal with jar's in war's. Therefore I don't know what you want to say with this. My question was if the two services are running within separate threads within the same JVM. If this is the case, the solution would be to use a self written repository selector and MDC. The MDC is kept on a per thread basis where you can store informations to identify your service. This information can then be used by the repository selector to return different repositories and therefore different logger instances although they are named equally. Simply said: you can have a root logger for each of your services. Heri -Original Message- From: Leon Pu [mailto:[EMAIL PROTECTED] Sent: Monday, December 12, 2005 6:09 PM To: Log4J Users List Subject: RE: Configure two log4j loggers in one application Hi Heri, they are in two sub projects, and will be compiled to two jars. But will be deployed to one war. Best regards, Leon --- Bender Heri [EMAIL PROTECTED] wrote: Do the two services run in different thread / thread-hierarchies? Heri - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Configure two log4j loggers in one application
I'm not sure whether these two services run in separate threads, because one service always invokes another one. Leon --- Bender Heri [EMAIL PROTECTED] wrote: I never had to deal with jar's in war's. Therefore I don't know what you want to say with this. My question was if the two services are running within separate threads within the same JVM. If this is the case, the solution would be to use a self written repository selector and MDC. The MDC is kept on a per thread basis where you can store informations to identify your service. This information can then be used by the repository selector to return different repositories and therefore different logger instances although they are named equally. Simply said: you can have a root logger for each of your services. Heri -Original Message- From: Leon Pu [mailto:[EMAIL PROTECTED] Sent: Monday, December 12, 2005 6:09 PM To: Log4J Users List Subject: RE: Configure two log4j loggers in one application Hi Heri, they are in two sub projects, and will be compiled to two jars. But will be deployed to one war. Best regards, Leon --- Bender Heri [EMAIL PROTECTED] wrote: Do the two services run in different thread / thread-hierarchies? Heri - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Configure two log4j loggers in one application
Sorry, I not yet understand your problem. Can you explain what do you mean by service? Are they just two different classes? Or packages? Or what? Annother question: At the moment, when you want to call a log function, does the context know which service it is running in? Are there different classes tight to the different services? (i.e. classes A, B, C are part of service #1 and classes D, E, F are part of service #2). Or are there classes which are sometimes part of service #1 and sometimes part of service #2? You have to explain more, or I cannot help you. Heri -Original Message- From: Leon Pu [mailto:[EMAIL PROTECTED] Sent: Monday, December 12, 2005 6:37 PM To: Log4J Users List Subject: RE: Configure two log4j loggers in one application I'm not sure whether these two services run in separate threads, because one service always invokes another one. Leon --- Bender Heri [EMAIL PROTECTED] wrote: I never had to deal with jar's in war's. Therefore I don't know what you want to say with this. My question was if the two services are running within separate threads within the same JVM. If this is the case, the solution would be to use a self written repository selector and MDC. The MDC is kept on a per thread basis where you can store informations to identify your service. This information can then be used by the repository selector to return different repositories and therefore different logger instances although they are named equally. Simply said: you can have a root logger for each of your services. Heri -Original Message- From: Leon Pu [mailto:[EMAIL PROTECTED] Sent: Monday, December 12, 2005 6:09 PM To: Log4J Users List Subject: RE: Configure two log4j loggers in one application Hi Heri, they are in two sub projects, and will be compiled to two jars. But will be deployed to one war. Best regards, Leon --- Bender Heri [EMAIL PROTECTED] wrote: Do the two services run in different thread / thread-hierarchies? Heri - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Configure two log4j loggers in one application
The service in IDE environment is a project. One project depends on another project, they will be compiled to two jars and deployed to same web application. Since they are different projects, so the package are different. The context knows which service it is running on. Different classes tight to different services. One class only can be in one service. I think I can use following log4j configuration to solve my problem. logger name=com.foo.service1 appender-ref ref=service1/ /logger logger name=com.foo.service2 appender-ref ref=service2/ /logger Thank you for your help. Leon --- Bender Heri [EMAIL PROTECTED] wrote: Sorry, I not yet understand your problem. Can you explain what do you mean by service? Are they just two different classes? Or packages? Or what? Annother question: At the moment, when you want to call a log function, does the context know which service it is running in? Are there different classes tight to the different services? (i.e. classes A, B, C are part of service #1 and classes D, E, F are part of service #2). Or are there classes which are sometimes part of service #1 and sometimes part of service #2? You have to explain more, or I cannot help you. Heri -Original Message- From: Leon Pu [mailto:[EMAIL PROTECTED] Sent: Monday, December 12, 2005 6:37 PM To: Log4J Users List Subject: RE: Configure two log4j loggers in one application I'm not sure whether these two services run in separate threads, because one service always invokes another one. Leon --- Bender Heri [EMAIL PROTECTED] wrote: I never had to deal with jar's in war's. Therefore I don't know what you want to say with this. My question was if the two services are running within separate threads within the same JVM. If this is the case, the solution would be to use a self written repository selector and MDC. The MDC is kept on a per thread basis where you can store informations to identify your service. This information can then be used by the repository selector to return different repositories and therefore different logger instances although they are named equally. Simply said: you can have a root logger for each of your services. Heri -Original Message- From: Leon Pu [mailto:[EMAIL PROTECTED] Sent: Monday, December 12, 2005 6:09 PM To: Log4J Users List Subject: RE: Configure two log4j loggers in one application Hi Heri, they are in two sub projects, and will be compiled to two jars. But will be deployed to one war. Best regards, Leon --- Bender Heri [EMAIL PROTECTED] wrote: Do the two services run in different thread / thread-hierarchies? Heri - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: log4j.xml validation
Dirk Ooms wrote: Hi, i am a bit puzzled on how i should do an apriori validation of a log4j.xml in log4j1.3 (without applying it to a LoggerRepository). The XML format used by log4j was not designed so that it can be effectively validated using standard XML validation technologies. It has been on my to-do list to attempt to design a modern XML configuration syntax with accompanying schema as at least a thought exercise. The essential problem with the current design is that XML validation technologies rarely support the value space of one attribute based on the value of another. So while: appender class=org.apache.log4j.FileAppender attribute name=file value=foo.log/ /appender and FileAppender file=foo.log xmlns=http://logging.apache.org/ have the same information content, but an XML schema can readily be written so that the file name is checked against a regular expression with the second form, but not the first. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]