-
1. Application specific jboss-logging.xml
jaikiran Feb 18, 2011 2:17 AM (in response to norsay)I've seen many users asking for this now. But before I go digging into the details, do you really want to configure logging through jboss-logging.xml or are you OK with setting it up with your application specific log4j.xml (if you are using Log4j)?
-
2. Application specific jboss-logging.xml
norsay Feb 18, 2011 2:24 AM (in response to jaikiran)There are several threads about that topic, you are absolutly right However I didn't find a useable answer for me...
Well, there is no absolut "must" for me to use jboss-logging.xml. If there is an other way to define an application specific logging (and as such seperate the logs into different files and log level into different files), that would also be acceptable for me or better the guys who have to operate JBoss...
-
3. Application specific jboss-logging.xml
jaikiran Feb 18, 2011 2:31 AM (in response to norsay)Norsay Norsay wrote:
If there is an other way to define an application specific logging (and as such seperate the logs into different files and log level into different files), that would also be acceptable for me or better the guys who have to operate JBoss...
Assuming that your application is using log4j for logging, it is possible to package a log4j.xml in each of your applications and the configuration in the log4j.xml can then direct the logs to separate log files (one each for each application). Furthermore, you can control the log levels of each application, separately in each of those files. However, the only "disadvantage" of this approach is that you can't change the logging levels or any other logging configurations of these applications, dynamically without redeploying the entire application - but that's the same even if when you package the jboss-logging.xml within each of the applications.
For an example on how to configure application specific log4j files, take a look at this thread http://community.jboss.org/message/198690#198690 (that was meant for JBoss AS 4.2.x, but I believe should be applicable even for AS6).
If you have more questions, feel free to ask.
-
4. Re: Application specific jboss-logging.xml
norsay Feb 18, 2011 3:03 AM (in response to jaikiran)Thanks for your answer! Correct me if I'm wrong, but it looks like the log4j.xml must be packed into the EAR file. As a consequence I have to repack the EAR (and change the log4j.xml) for each environment which should have different logging behavior... Ok, if there is no other way, this could be a fall back scenario. However my goal is to have a EAR independant configuration (in other words, the EAR artifact must not contain any environment specific informations). Dynamic logging configuration changes are not in the scope...
Just to bring some more light into the dark, the concret deployment scenario looks like this:
- We use Maven to build a release and as a result we have a EAR artifact.
- The EAR will be deployed to different systems/environment (let's call them integration, test and production)
- The logging configuration must be defined per system (because we like to see debug information only on integration system - in production environment we would like to log only warnings and errors) - so we like to have an external configuration for the logging per environment (without having to repack the EAR of course)
-
5. Application specific jboss-logging.xml
jaikiran Feb 18, 2011 3:05 AM (in response to norsay)Norsay Norsay wrote:
Thanks for your answer! Correct me if I'm wrong, but it looks like the log4j.xml must be packed into the EAR file.
That's correct, it'll have to go in each .ear file.
Norsay Norsay wrote:
Just to bring some more light into the dark, the concret deployment scenario looks like this:
- We use Maven to build a release and as a result we have a EAR artifact.
- The EAR will be deployed to different systems/environment (let's call them integration, test and production)
- The logging configuration must be defined per system (because we like to see debug information only on integration system - in production environment we would like to log only warnings and errors) - so we like to have an external configuration for the logging per environment (without having to repack the EAR of course)
Right, that's the "disadvantage" I was talking about. I understand that using the server profile level jboss-logging.xml to control the logging is convenient and helps get past these issues. So yeah, let me see if I can put together something during this weekend.
-
6. Re: Application specific jboss-logging.xml
norsay Feb 18, 2011 3:26 AM (in response to jaikiran)Ok, great Looking forward reading from you
-
7. Re: Application specific jboss-logging.xml
norsay Feb 28, 2011 2:30 AM (in response to norsay)Are there any news about this logging issue? I should have a solution till end of this week...
-
8. Application specific jboss-logging.xml
jaikiran Feb 28, 2011 2:45 AM (in response to norsay)I did try this partially on a weekend and found that there's a bug in there http://community.jboss.org/message/588710#588710. I could find a workaround too, but couldn't yet spend more time in getting it completely working.
-
9. Re: Application specific jboss-logging.xml
norsay Feb 28, 2011 3:53 AM (in response to jaikiran)No problem. Any hints or workaround for this problem are still very welcome
-
10. Application specific jboss-logging.xml
newway Feb 28, 2011 6:39 AM (in response to norsay)another approach will be to implement a repository selector.
this is described in section 10.3.8 here - http://docs.jboss.org/process-guide/en/html/logging.html
and also here - http://community.jboss.org/wiki/Log4jRepositorySelector
this is what i did in my app - the benefit of this approach is that you don't package the log4j.jar in the app and you are telling it from where to take the configurations file - so changing the configuration won't imply a redeploy of your app
the only thing you need to watch when using the repository selector is that you need to do the initialization in all the relevant class loaders.
i did a base class for EJBs that has a post construct method to init the log.
-
11. Re: Application specific jboss-logging.xml
norsay Feb 28, 2011 7:20 AM (in response to newway)Great hint, thanks a lot! Guess I have to look at this solution a bit closer