1. JBOSS7 Configuration Log Theory Knowledge introduction
Jboss 7th logs can be configured within the XML configuration file and the log Management properties file. The default log is configured within the configuration directory's Logging.properties file.
Typically, the default value within Logging.properties is sufficient for most installations. If you want to customize the log type, we recommend that you configure it within the XML configuration text (standalone.xml or domain.xml file, logging subsystem), and you can define 7 main categories:
<root-logger/>
<logger category= ""/>
>console-handler/>
<file-handler/>
<periodic-rotating-file-handler/>
<size-rotating-file-handler/>
<async-handler/>
Primarily, the XML configuration file should be used, and the log management properties are ignored when the logging subsystem is started.
Resources:
http://download.csdn.net/detail/lypf19900912/8844043
Https://docs.jboss.org/author/display/AS71/Logging+Configuration
2. Example
The following is a detailed example of how the XML configuration file and log management properties are logged if you log JBoss 7
1. XML configuration
The XML configuration here refers to the Standalone.xml or domain.xml files, which are XML configuration files that are launched by Standalond and domain mode, respectively. Taking Standalone.xml as an example
The configuration information about the log in the Standalone.xml file is as follows:
<subsystem xmlns= "urn:jboss:domain:logging:1.3" > <console-handler name= "Console" > <level name= "INFO"/> <formatter> <pattern-formatter pattern= "%k{level }%D{HH:MM:SS,SSS}%-5p [%c] (%t)%s%e%n "/> </formatter> </console-handler> <periodic-rotating-file-handler name= "File" autoflush= "true" > <formatter> <pattern-formatter pattern= "%d{hh:mm:ss,sss}%-5p [%c] (%t)%s%e%n"/> </formatter> <file relative-to= "Jboss.server.log.dir" path= "Server.log"/> <suffix value= ". Yyyy-mm-dd"/> ; <append value= "true"/> </periodic-rotating-file-handler> <logger category= "Com.arjuna "> <level name=" WARN "/> </logger> <logger category=" ORG.APACHE.TOMC At.util. Modeler "> <level name=" WARN "/> </logger> <logger category=" Org.jbo Ss.as.config "> <level name=" DEBUG "/> </logger> <logger category=" su N.rmi "> <level name=" WARN "/> </logger> <logger category=" Jacorb " ; <level name= "WARN"/> </logger> <logger category= "Jacorb.config" > &L T;level name= "ERROR"/> </logger> <root-logger> <level name= "INFO"/& Gt
The following configuration makes a simple explanation: Log output to console and file. Other file, located in Server.log. Log level is info
We can start with a look at the results.
Console (console)
Server.log (log file)
2. Logging-properties (log manager)Log Manager and Standalone.xml under the same directory, if you want to use the Log manager, you must delete the associated configuration of the log in the XML file. For good distinction, the log file name is Server_properties.log in the log Manager
Logging.properties
# Note This file has been generated and would be overwritten if a# logging subsystem have been defined in the XML Configurat ion.# Additional Loggers To configure (the root logger are always configured) Loggers=jacorb,com.arjuna, org.apache.tomcat.util.modeler,org.jboss.as.config,jacorb.config,sun.rmilogger.level=infologger.handlers= Console,filelogger.jacorb.level=warnlogger.jacorb.useparenthandlers=truelogger.com.arjuna.level= Warnlogger.com.arjuna.useparenthandlers=truelogger.org.apache.tomcat.util.modeler.level= Warnlogger.org.apache.tomcat.util.modeler.useparenthandlers=truelogger.org.jboss.as.config.level= Debuglogger.org.jboss.as.config.useparenthandlers=truelogger.jacorb.config.level= errorlogger.jacorb.config.useparenthandlers=truelogger.sun.rmi.level=warnlogger.sun.rmi.useparenthandlers= Truehandler. Console=org.jboss.logmanager.handlers.consolehandlerhandler.console.level=infohandler.console.formatter= Consolehandler.console.properties=autoflush,target,enabledhandler. Console.autoflush=truEhandler. Console.target=system_outhandler.console.enabled=truehandler. File=org.jboss.logmanager.handlers.periodicrotatingfilehandlerhandler.file.level=allhandler.file.formatter= filehandler.file.properties=append,autoflush,enabled,suffix,filenamehandler.file.constructorproperties= Filename,appendhandler. File.append=truehandler. File.autoflush=truehandler. File.enabled=truehandler. File.suffix=.yyyy-mm-dd<span style= "FONT-SIZE:14PX;" ><span style= "color: #ff0000;" >handler. File.filename=c\:\\jboss-eap-6.2\\standalone\\log\\server_properties.log</span></span>formatter. Console=org.jboss.logmanager.formatters.patternformatterformatter.console.properties=patternformatter. CONSOLE.PATTERN=%K{LEVEL}%D{HH\:MM\:SS,SSS}%-5p [%c] (%t)%s%e%nformatter. File=org.jboss.logmanager.formatters.patternformatterformatter.file.properties=patternformatter. File.constructorproperties=patternformatter. FILE.PATTERN=%D{HH\:MM\:SS,SSS}%-5p [%c] (%t)%s%e%n
Results show
3. Relationship of XML configuration and log Manager
1. Priority: The XML configuration is higher than the log manager, which is said to use the XML configuration file, the log manager is ignored. 2. The configuration XML is synchronized to the log manager---multiple log files can be generated, recording different logs separatelyFor example, we add another file_test to the XML, and when we allow JBoss, the File_test configuration is synchronized to the log manager. However, this synchronization is single-directional, meaning that only the XML configuration is synchronized to the log manager, and the changes in the Log Manager are not synchronized to the XML file.
Add file_test to Standalone.xml file, generate Server_test.log
<subsystem xmlns= "urn:jboss:domain:logging:1.3" > <console-handler name= "Console" > <level name= "INFO"/> <formatter> <pattern-formatter pattern= "%k{level }%D{HH:MM:SS,SSS}%-5p [%c] (%t)%s%e%n "/> </formatter> </console-handler> <periodic-rotating-file-handler name= "File" autoflush= "true" > <formatter> <pattern-formatter pattern= "%d{hh:mm:ss,sss}%-5p [%c] (%t)%s%e%n"/> </formatter> <file relative-to= "Jboss.server.log.dir" path= "Server.log"/> <suffix value= ". Yyyy-mm-dd"/> ; <append value= "true"/> <span style= "Font-size:14px;color: #ff0000;" > </periodic-rotating-file-handler><periodic-rotating-file-handler name= "FILE_TEST" autoflush= "true" > <formatter> <pattern-formatter pattern= "%d{hh:mm:ss,sss}%-5p [%c] (%t)%s%e%n"/> </formatter> <file relative-to= "Jboss.server.log.dir" path= "Server_test.log"/> <suffix value= ". Yyyy-mm-dd "/> <append value=" true "/> </periodic-rotating-file-handler></span> <logger category= "Com.arjuna" > <level name= "WARN"/> </logger> & Lt;logger category= "Org.apache.tomcat.util.modeler" > <level name= "WARN"/> </LOGGER&G T <logger category= "Org.jboss.as.config" > <level name= "DEBUG"/> </logger> <logger category= "Sun.rmi" > <level name= "WARN"/> </logger> < ; Logger category= "Jacorb" > <level name= "WARN"/> </logger> <logger C Ategory= "JAcorb.config "> <level name=" ERROR "/> </logger> <root-logger> <level name= "INFO"/>
After you start JBoss success, the resulting log file
View Logging.properties
<span style= "FONT-SIZE:14PX;" ># Note This file has been generated and would be overwritten if a# logging subsystem have been defined in the XML config uration.# Additional Loggers To configure (the root logger are always configured) Loggers=jacorb,com.arjuna, org.apache.tomcat.util.modeler,org.jboss.as.config,jacorb.config,sun.rmilogger.level=infologger.handlers= Console,file,file_testlogger.jacorb.level=warnlogger.jacorb.useparenthandlers=truelogger.com.arjuna.level= Warnlogger.com.arjuna.useparenthandlers=truelogger.org.apache.tomcat.util.modeler.level= Warnlogger.org.apache.tomcat.util.modeler.useparenthandlers=truelogger.org.jboss.as.config.level= Debuglogger.org.jboss.as.config.useparenthandlers=truelogger.jacorb.config.level= errorlogger.jacorb.config.useparenthandlers=truelogger.sun.rmi.level=warnlogger.sun.rmi.useparenthandlers= Truehandler. Console=org.jboss.logmanager.handlers.consolehandlerhandler.console.level=infohandler.console.formatter= Consolehandler.console.properties=autofluSh,target,enabledhandler. Console.autoflush=truehandler. Console.target=system_outhandler.console.enabled=true</span><span style= "Font-size:14px;color: #ff0000;" >handler. File_test=org.jboss.logmanager.handlers.periodicrotatingfilehandlerhandler.file_test.level=allhandler.file_ Test.formatter=file_testhandler.file_test.properties=append,autoflush,enabled,suffix,filenamehandler.file_ Test.append=truehandler. File_test.autoflush=truehandler. File_test.enabled=truehandler. File_test.suffix=.yyyy-mm-ddhandler.file_test.filename=c\:\\jboss-eap-6.2\\standalone\\log\\server_test.log </span><span style= "FONT-SIZE:14PX;" >handler. File=org.jboss.logmanager.handlers.periodicrotatingfilehandlerhandler.file.level=allhandler.file.formatter= filehandler.file.properties=append,autoflush,enabled,suffix,filenamehandler.file.constructorproperties= Filename,appendhandler. File.append=truehandler. File.autoflush=truehandler. File.enabled=truehandler. File.suffix=.yyyy-mm-ddhandler.file.filename=c\:\\jboss-eap-6.2\\standalone\\log\\server.logformatter.console= Org.jboss.logmanager.formatters.patternformatterformatter.console.properties=patternformatter. CONSOLE.PATTERN=%K{LEVEL}%D{HH\:MM\:SS,SSS}%-5p [%c] (%t)%s%e%n<span style= "color: #ff0000;" >formatter. File_test=org.jboss.logmanager.formatters.patternformatterformatter.file_test.properties=patternformatter. File_test.constructorproperties=patternformatter. FILE_TEST.PATTERN=%D{HH\:MM\:SS,SSS}%-5p [%c] (%t)%s%e%n</span>formatter. File=org.jboss.logmanager.formatters.patternformatterformatter.file.properties=patternformatter. File.constructorproperties=patternformatter. FILE.PATTERN=%D{HH\:MM\:SS,SSS}%-5p [%c] (%t)%s%e%n</span>
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Jboss 7 Configuration Log