-
1. Re: Add new loggers in runtime
sfcoy Jul 16, 2013 3:34 AM (in response to flp05)You have fundamentally the same problem as jboss log info twice.
Personally, I recommend that you remove all of this logging support stuff from your application and manage it in the server. Less code is better code!
-
2. Re: Add new loggers in runtime
flp05 Jul 16, 2013 4:25 AM (in response to sfcoy)Thanks Stephen.
My loggers have to be created dynalically, therefore they need to be managed in the code.
In the server configuration I have the main log, which receives all the logs from the application. But, then, I have many classes which need to log into different files every time they run. It's impossible to define that on the server configuration, because only on runtime it can be defined.
How can I do that? Any ideas?
-
3. Re: Add new loggers in runtime
sfcoy Jul 16, 2013 9:23 AM (in response to flp05)Check out a source copy of the version of log4j that you're using, change the base package name (from org.log4j to [say] com.yourcompany.log4j - I believe that the licence permits this, but check for yourself) and use this version for your dynamic logging requirements.
-
4. Re: Add new loggers in runtime
jamezp Jul 16, 2013 4:13 PM (in response to sfcoy)You could also exclude log4j from being added to the deployment and package it with your application as well. That should allow you to create loggers programmatically.
--
James R. Perkins
-
5. Re: Add new loggers in runtime
sfcoy Jul 16, 2013 8:17 PM (in response to jamezp)I think Luis wants to use both regular JBoss logging (the "main log") plus create loggers dynamically from within his code...
-
6. Re: Add new loggers in runtime
flp05 Jul 19, 2013 6:55 AM (in response to flp05)Thank you Stephen and James.
In the past couple of days, I tested a few more ideas, but none of them allow me to do exactly what i want,
Stephen Coy, that was a good suggestion but the problem is the logging is not made explicitily by me, but by a framework (internal from my company). I can not change the framework as it's shared from multiple applications.
James Perkins, I already tried to remove the logging from Jboss (by excluding log4j and/or commonsloggings), but nothing seems to work. It may be related to the framework I'm using, as the framework jars are placed in the EAR/lib. Also, I have to keep a "centralized" logging system wihtin the server, as multiple applications share the same log.
So, to let perfectly clear what I want to do:
- I want to have a main logging system which serves multiple applications and the configurations are placed in the server (either on standalone.xml or in a log4j.xml).
- I also want to be able to, during execution, create loggers dynamically (to do this I use the framework that I talked about, which uses log4j).
- This was working perfectly in Jboss 4 in two very big and complex applications. Changes in the code are not easy to perform. I aready tried multiple solutions based on multiples posts I read only about jboss 7 logging.
I have a question that may help me finding a solution? Can I completely disable Jboss logging system, and still let the log4j.xml file in the Jboss server, using the same file from all the applications?
Thanks again,
Luís Oliveira
-
7. Re: Add new loggers in runtime
jamezp Jul 21, 2013 6:39 PM (in response to flp05)1 of 1 people found this helpfulI want to have a main logging system which serves multiple applications and the configurations are placed in the server (either on standalone.xml or in a log4j.xml).
With standalone.xml you can do this with no problems. You could do it with log4j.xml for your deployments only, but not the server logging. For example org.jboss.as.* will not be logged through the log4j log manager.
I also want to be able to, during execution, create loggers dynamically (to do this I use the framework that I talked about, which uses log4j).
This is not possible with the logging subsystem (central logging configuration). While you could do that now, in the future we will likely lock down changes via code for at least the server level log manager configuration.
This was working perfectly in Jboss 4 in two very big and complex applications. Changes in the code are not easy to perform. I aready tried multiple solutions based on multiples posts I read only about jboss 7 logging.
There have been quite a few changes from JBoss AS 4 to JBoss AS 7. The last release for AS 4 was just over 5 years ago
In general I would suggest using the logging subsystem. It allows for runtime configuration changes.
--
James R. Perkins
-
8. Re: Add new loggers in runtime
flp05 Jul 23, 2013 11:05 AM (in response to jamezp)James, basically you are saying that there is no solution to use the jboss logging system and also create loggers dynamically in runtime?
-
9. Re: Add new loggers in runtime
jamezp Jul 23, 2013 5:55 PM (in response to flp05)I'll take the cheap way out and say that it should work like that for now, assuming you use either JBoss Log Manager or JUL, but we might break that in the future You could however, note this is not portable, use the management API's available to configure logging in your code though.
--
James R. Perkins