5 Replies Latest reply on Jul 31, 2017 8:02 AM by manarh

    Random log rotation

    gregms

      I'm finding that my windup logs are being rotated randomly. I've tried looking through documentation but hadn't had a lot of luck other than it can be random based upon your suffix, but this just seemed odd to me.

      With the default settings in the Rotating handler section, how often should I expect the logs to be rotated and what do I need to change if I want it to occur more often (or even stop it from rotating so I can just use logrotate)?

       

      From logging.properties, Relevant section:

      # Rotating handler

      handler.FILE=org.jboss.logmanager.handlers.PeriodicRotatingFileHandler

      handler.FILE.level=ALL

      handler.FILE.formatter=PATTERN

      handler.FILE.properties=autoFlush,append,fileName,suffix

      handler.FILE.constructorProperties=fileName,append

      handler.FILE.autoFlush=true

      handler.FILE.append=true

      handler.FILE.fileName=${org.jboss.forge.log.file:forge.log}

      handler.FILE.suffix=.yyyy-MM-dd

        • 1. Re: Random log rotation
          jsightler

          That properties file is using JBoss Logging's PeriodicRotatingFileHandler. The Javadoc is here: PeriodicRotatingFileHandler (JBoss Application Server: Build 7.1.2.Final API)

           

          It seems that this should rotate it daily. I'm not sure how it could behave differently? Are you seeing gaps in the dates?

          • 2. Re: Random log rotation
            gregms

            Yes, it hasn't been consistent and I haven't found any pattern. I manually rotated and compressed the log file on 2017-07-11 as the file had grown to be over 700MB. I changed it to only log on WARN at that point. It's rotated a few times on its own since then but it doesn't match any reboot time either. Using the Windup_Jenkins_Plugin v1.0.0

             

            Here is what it currently looks like:

            [<user>@<server> log]# ll -h

            total 51M

            -rw-r--r-- 1 <user> <group> 8.1M Jul 25 05:24 windup.log

            -rw-r--r-- 1 <user> <group> 799K Jan 31 14:35 windup.log.2017-01-31

            -rw-r--r-- 1 <user> <group> 687K Feb 17 02:07 windup.log.2017-02-17

            -rw-r--r-- 1 <user> <group> 687K Mar 17 02:08 windup.log.2017-03-17

            -rw-r--r-- 1 <user> <group> 1.4M Mar 22 08:04 windup.log.2017-03-22

            -rw-r--r-- 1 <user> <group>  34M Jul 11 14:25 windup.log.2017-07-11.bz2

            -rw-r--r-- 1 <user> <group> 5.4M Jul 15 10:05 windup.log.2017-07-15

            -rw-r--r-- 1 <user> <group> 342K Jul 16 06:58 windup.log.2017-07-16

             

            [<user>@<server> log]# uptime

            10:40:49 up 54 days, 18:03,  3 users,  load average: 0.00, 0.02, 0.02

             

            Here was what I was thinking of adding if it isn't working on its own (4MB, 24 files to keep):

            handler.FILE.rotateSize=4000000

            handler.FILE.setMaxBackupIndex=24

             

            As the log files don't log the date (only time) the logs aren't very useful when they are all lumped together. At least as far as these files go as developers would generally read their relevant log section in the console of their Jenkins jobs.

            • 3. Re: Random log rotation
              jsightler

              I feel like there is a misunderstanding going on here with regards to what is actually happening. windup (or rhamt if you are using newer versions) is available in a few different distributions:

               

              • CLI - uses ~/.windup/log/windup.log or ~/.rhamt/log/rhamt.log depending upon which version is being used
              • Maven Plugin - Does not log to ~/.windup/log or any other local file -- logs to the console
              • Web (RHAMT only) - Logs to server.log in a typical zip installation or to the console in the OpenShift installation

               

              The only one that could be using the files that you are referencing appears to be the CLI tool. This does not run as a daemon and thus would only produce logs when a user manually triggers the tool to run. If you are seeing gaps, it is likely because noone ran the tool on those days.

               

              The log format itself can be modified if that is desired by changing "formatter.PATTERN.pattern" to include the date in the format string.

              • 4. Re: Random log rotation
                gregms

                While I would agree it is only being ran when a build is being triggered, it is most definitely running on days it isn't rotating.

                The logs don't get up to 700MB+ in just one day. I can trace back through the log files to confirm they extend multiple days.

                 

                I was less sure what formatter should be. If that can be changed to just always have the date as part of the file, that might be the easiest solution. It still concerns me though what is triggering the rotation that currently is happening. We have a Windows slave as well (this one is Linux) and it has different rotation days so it wasn't just a restart of Jenkins and wasn't a restart of the server itself. Something else must be triggering it. Any idea what could be as there isn't a daemon running?

                • 5. Re: Random log rotation
                  manarh

                  Hi Greg,

                   

                  can you more explain your sentence Using the Windup_Jenkins_Plugin v1.0.0 ?

                   

                  I searched the web and found only this GitHub - bjabram/windup-jenkins-plugin: Jenkins plugin for JBoss Windup but that doesn't seem to be what is integrated with Windup.

                   

                  But to be clear we don't created any Jenkins plugin, so we can't be sure what it does, if it only runs CLI or something different code.