3

My configuration is below in standalone.xml:

<async-handler name="MY_ASYNC">
    <level name="DEBUG" />
    <queue-length value="1024" />
    <overflow-action value="block" />
    <subhandlers>
        <handler name="APPLICATION" />
    </subhandlers>
</async-handler>
<size-rotating-file-handler name="APPLICATION" autoflush="true">
    <formatter>
        <pattern-formatter pattern="%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%c] (%t) %m%n" />
    </formatter>
    <file relative-to="jboss.server.log.dir" path="application.log" />
    <rotate-size value="30m" />
    <append value="true" />
    <suffix value=".yyyy-MM-dd-HH-mm-ss" />
</size-rotating-file-handler>
<logger category="com.company" use-parent-handlers="false">
    <level name="DEBUG" />
    <handlers>
        <handler name="MY_ASYNC" />
    </handlers>
</logger>

application.log

2020-04-24 17:07:53,421 DEBUG [com.company.test.security.filter.BaseFilter] (default task-35) doFilter : Enter
2020-04-24 17:07:53,422 DEBUG [com.company.test.security.util.PublicUriUtil] (default task-35) isPublicUri : contextPath : /test : requestURI : /test/listing
2020-04-24 17:07:53,422 DEBUG [com.company.test.security.util.PublicUriUtil] (default task-35) isPublicUri : contextPath : /test : URI list : [/test/updateCache, /test/generic_response, /test/webreports, /test/login, /test/login.html]
2020-04-24 17:07:53,422 DEBUG [com.company.test.security.util.PublicUriUtil] (default task-35) /test/listing : isPublicUri : false
2020-04-24 17:07:53,422 DEBUG [com.company.test.security.filter.BaseFilter] (default task-35) doFilter : Checking for public URI : +/test/listing : isSkipSecurityFilter : false
2020-04-24 17:07:53,422 DEBUG [com.company.test.security.filter.BaseFilter] (default task-35) doFilter : /test/listing, Authentication needed, do process filter
2020-04-24 17:07:53,422 DEBUG [com.company.test.security.filter.SecurityFilter] (default task-35) processFilter : Enter

I can not identify from application.log that logger is working in Async mode or not.

  • Can I identify from the log file that my log is in Sync or Async?

  • Can I print thread id of Sync or Async log?

  • Is log file Showing actual times when excution came into the log statement or wrote into the log file for Async logging?

  • I'm not sure I follow what you mean. It definitely logs it's own thread. – James R. Perkins Feb 14 '20 at 00:20
  • I'm also not sure what is your requirement ? From question it is not clear. – Anish B. Apr 28 '20 at 09:37
  • If I do not use the Async handler then logs print in same pattern. How can I know that my log is printed using Async handler? is it possible the time variation between code execution 'log.debug("Enter display")' and log printed '2020-04-24 17:07:53,421 DEBUG [com.company.test.Test] (default task-35) Enter display' ? Because log message goes in queue and if queue becomes full then wait for printing log in log file. – vishal patel Apr 29 '20 at 14:20

0 Answers0