-
1. Re: jboss logging: can I change the conf of logging system programmatically?
nickarls Nov 20, 2012 5:00 AM (in response to liuliu)You should be able to use a ModelControllerClient and change everything you can from the CLI.
-
2. Re: jboss logging: can I change the conf of logging system programmatically?
liuliu Nov 20, 2012 5:35 AM (in response to nickarls)thanks for your quick reply.
I dont want change the configuration in the xml file by program. What i want is change it dynamically.
-
3. Re: jboss logging: can I change the conf of logging system programmatically?
nickarls Nov 20, 2012 6:02 AM (in response to liuliu)The changes made through the ModelControllerClient are automatically persisted to the xml.
https://docs.jboss.org/author/display/AS71/The+native+management+API
-
4. Re: jboss logging: can I change the conf of logging system programmatically?
liuliu Nov 20, 2012 6:53 AM (in response to nickarls)I think i was not clear, i dont want change the xml. I have read a post about application level log with log4j in jboss 7. But i want to use jboss logging system, so i ask if I can configure my log in my application withou touching standalone.xml and module.
-
5. Re: jboss logging: can I change the conf of logging system programmatically?
nickarls Nov 20, 2012 7:26 AM (in response to liuliu)1 of 1 people found this helpfulThere appear to have been some work done for it according to
https://issues.jboss.org/browse/AS7-514
but I'm not sure what can be done in runtime.
-
6. Re: jboss logging: can I change the conf of logging system programmatically?
sfcoy Nov 20, 2012 7:45 AM (in response to liuliu)You can change application logging using the command line:
{code:bash}bin/jboss-cli.sh --connect "/subsystem=logging/logger=com.your.package.name:add(level=DEBUG)"{code}
but this will be persisted in the xml for you.
You can also place the CLI commands in a batch file and execute a bunch of them at once if you want. I think that counts as "programmatically".
Have a look at AS71 CLI Recipes - ScriptedConfiguration.
-
7. Re: jboss logging: can I change the conf of logging system programmatically?
liuliu Nov 20, 2012 8:25 AM (in response to nickarls)yes this is what i need, but I must wait till the release of 7.2?
-
8. Re: jboss logging: can I change the conf of logging system programmatically?
nickarls Nov 20, 2012 8:30 AM (in response to liuliu)It's also included in the 7.1.(2/3/4) releases so you could build from those tags. For the community version, you'll have to wait for 7.2.
-
9. Re: jboss logging: can I change the conf of logging system programmatically?
liuliu Nov 23, 2012 5:04 AM (in response to nickarls)hi,
I am trying per-deployment log wiht a jboss-as-7.1.3, i try to use jboss-logging, i removed log4j.jar and common-logging jar in my application.
my log4j.properties is loaded, I can see it in the console, my log file is created, but nothing is logged in the file. and my log is not going in the server.log neither.
what i understand is jboss-logging is a log facade, it choose jboss logmanager, log4j, slf4j-logback or jul logmanager when it find it in the class path. correct me if i am wrong? So how do i know which logmanager is chosen?
thanks in advance.
-
10. Re: jboss logging: can I change the conf of logging system programmatically?
jamezp Nov 24, 2012 3:55 PM (in response to liuliu)If used within JBoss AS it will choose JBoss Log Manager. If you want your application to use it's own configuration you'd need to use a logging.properties file. It's very similar to a log4j style properties file.
Here is an example logging.properties file
# Additional logger names to configure (root logger is always configured) loggers=com.example # Dump system environment at boot by default logger.com.example.level=DEBUG # Root logger level logger.level=INFO # Root logger handlers logger.handlers=CONSOLE # Console handler configuration handler.CONSOLE=org.jboss.logmanager.handlers.ConsoleHandler handler.CONSOLE.properties=autoFlush handler.CONSOLE.level=INFO handler.CONSOLE.autoFlush=true handler.CONSOLE.formatter=PATTERN # Formatter pattern configuration formatter.PATTERN=org.jboss.logmanager.formatters.PatternFormatter formatter.PATTERN.properties=pattern formatter.PATTERN.pattern=%d{HH:mm:ss,SSS} %-5p [%c] %s%E%n
--
James R. Perkins