This content has been marked as final.
Show 1 reply
-
1. Re: How to create separate log file rather than server log in switchyard and wildfly 8
amit4497 Jul 26, 2017 11:45 AM (in response to hemanthjboss)Wildfly has a logging subsystem which can be found in standalone.xml/domain.xml.
This subsystem can be modified for creating separate log files. It supports several handlers like periodic-rotating-file-handler, size-rotating-file-handler, custom-handler (in case you have your own logging implementation), etc...
You can select a handler as per your requirement and a corresponding logger category has to be created.
In order to modify the standalone.xml/domain.xml file directly :
<periodic-rotating-file-handler name="MYLOG" autoflush="true"> <formatter> <pattern-formatter pattern="%d{dd-MM-yyyy HH:mm:ss,SSS}|%-5p|%m%n"/> </formatter> <file relative-to="jboss.server.log.dir" path="mylog_example.log"/> <suffix value=".yyyy-MM-dd"/> <append value="true"/> </periodic-rotating-file-handler> <logger category="com.mylog.example" use-parent-handlers="false"> <level name="INFO"/> <handlers> <handler name="MYLOG"/> </handlers> </logger>
In case you are using CLI :
/subsystem=logging/periodic-rotating-file-handler=MYLOG:add(autoflush="true", formatter="%d{dd-MM-yyyy HH:mm:ss,SSS}|%-5p|%m%n", file={"relative-to"=>"jboss.server.log.dir","path"=>"mylog_example.log"}, suffix=".yyyy-MM-dd", append=true) /subsystem=logging/logger=com.mylog.example:add(use-parent-handlers=false, handlers=[handler="MYLOG"], level=INFO)
Hope this helps!!!