Note that there are some explanatory texts on larger screens.

plurals
  1. POJava Monitor logging file
    text
    copied!<p>I'm developing a tool to monitor logging files of several application, those applications use either java.logging or Log4j.</p> <p>The appender is always a rolling file appender with the size of the file as trigger for the rolling. When a rolling happens for both ( java.logging and log4j ) all logging files are renamed to allow the current logging file to have the same name. </p> <p>My problem is if i'm currently reading the logging file i'm keeping it from being renamed and therefore it will be erase because the logger will not append on a file it should have just created. </p> <p>I tried to use a socketAppender to avoid reading on a file and directly gathering the data, but the action of logging takes at least 0,1ms (0,02 with a fileAppender) and as i have a granularity of 1ms for one of my application i can't use this.</p> <p>I obtained those result by changing the configuration of my loggers and using this code </p> <pre><code>long start=System.currentTimeMillis(); long numberOfLog=0; long total=1000000; while(numberOfLog&lt;total){ log.info(" "+numberOfLog); numberOfLog++; } long duree=System.currentTimeMillis()-start; System.out.println("la durée est de "+duree+"ms pour "+total+" logs"); </code></pre> <p>Now i'm wondering is there any solution to read those logging file without interfering with the rename ? Or is there a solution to configure those tools ( log4j, java.logging ) to roll on a size trigger and whithout renaming the files (using date for the name or other solutions) ?</p> <p>Thank you for your feedback</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload