Tomcat catalina.out log file not rolling over

Since upgrading from IDM 4.5 to 4.6 our catalina.out file no longer rolls over on a daily basis. The other rolling files like idapps and localhost_access_log are rolling over correctly. I have searched the forums and most people reporting this issue were on a windows machine where there is a fix but this is a linux box. I have also seen people saying a restart of Tomcat fixed issue but I have tried that as well. Every time we restart it just creates a new blank file with the date like catalina.2018-05-08.log but the file is blank and it continues to write to the catalina.out file.

We have a 4.7 test environment and the catalina.out file is rolling over correctly on that version. I have compared the log4j.properties files on both systems and they are the same and I have included the setting below. Any ideas on what else we can try to fix this issue?

log4j.appender.CATALINA = org.apache.log4j.DailyRollingFileAppender
log4j.appender.CATALINA.File = /opt/netiq/idm/apps/tomcat/logs/catalina.out
log4j.appender.CATALINA.Append = true
log4j.appender.CATALINA.Encoding = UTF-8
# Roll-over the log once per day
log4j.appender.CATALINA.DatePattern = '.'yyyy-MM-dd'.log'
log4j.appender.CATALINA.layout = org.apache.log4j.PatternLayout
log4j.appender.CATALINA.layout.ConversionPattern = %d [%t] %-5p %c- %m%n
  • CHSB1130;2480684 wrote:
    Since upgrading from IDM 4.5 to 4.6 our catalina.out file no longer rolls over on a daily basis. The other rolling files like idapps and localhost_access_log are rolling over correctly. I have searched the forums and most people reporting this issue were on a windows machine where there is a fix but this is a linux box. I have also seen people saying a restart of Tomcat fixed issue but I have tried that as well. Every time we restart it just creates a new blank file with the date like catalina.2018-05-08.log but the file is blank and it continues to write to the catalina.out file.

    We have a 4.7 test environment and the catalina.out file is rolling over correctly on that version. I have compared the log4j.properties files on both systems and they are the same and I have included the setting below. Any ideas on what else we can try to fix this issue?

    log4j.appender.CATALINA = org.apache.log4j.DailyRollingFileAppender
    log4j.appender.CATALINA.File = /opt/netiq/idm/apps/tomcat/logs/catalina.out
    log4j.appender.CATALINA.Append = true
    log4j.appender.CATALINA.Encoding = UTF-8
    # Roll-over the log once per day
    log4j.appender.CATALINA.DatePattern = '.'yyyy-MM-dd'.log'
    log4j.appender.CATALINA.layout = org.apache.log4j.PatternLayout
    log4j.appender.CATALINA.layout.ConversionPattern = %d [%t] %-5p %c- %m%n


    On 4.6, I seem to recall having to resort to a logrotate job with truncate to deal with catalina.out.
  • Did you try the suggestions outlined in the "NetIQ Identity Manager 4.6
    Service Pack 1 Release Notes" ?

    See
    https://www.netiq.com/documentation/identity-manager-46/releasenotes_idm461/data/releasenotes_idm461.html?view=print

    Look for "userapp-log4j.xml"


    Wolfgang

    On 09/05/2018 17:04, CHSB1130 wrote:
    >
    > Since upgrading from IDM 4.5 to 4.6 our catalina.out file no longer
    > rolls over on a daily basis. The other rolling files like idapps and
    > localhost_access_log are rolling over correctly. I have searched the
    > forums and most people reporting this issue were on a windows machine
    > where there is a fix but this is a linux box. I have also seen people
    > saying a restart of Tomcat fixed issue but I have tried that as well.
    > Every time we restart it just creates a new blank file with the date
    > like catalina.2018-05-08.log but the file is blank and it continues to
    > write to the catalina.out file.
    >
    > We have a 4.7 test environment and the catalina.out file is rolling over
    > correctly on that version. I have compared the log4j.properties files
    > on both systems and they are the same and I have included the setting
    > below. Any ideas on what else we can try to fix this issue?
    >
    > log4j.appender.CATALINA = org.apache.log4j.DailyRollingFileAppender
    > log4j.appender.CATALINA.File =
    > /opt/netiq/idm/apps/tomcat/logs/catalina.out
    > log4j.appender.CATALINA.Append = true
    > log4j.appender.CATALINA.Encoding = UTF-8
    > # Roll-over the log once per day
    > log4j.appender.CATALINA.DatePattern = '.'yyyy-MM-dd'.log'
    > log4j.appender.CATALINA.layout = org.apache.log4j.PatternLayout
    > log4j.appender.CATALINA.layout.ConversionPattern = %d [%t] %-5p %c- %m%n
    >
    >

  • Same error i followed the link now foolowing error is coming.

    java.io.FileNotFoundException: C:\NetIQ\IdentityManager\apps\tomcat\logs\catalina.out (The process cannot access the file because it is being used by another process)
    at java.io.FileOutputStream.open0(Native Method)
    at java.io.FileOutputStream.open(FileOutputStream.java:270)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:133)
    at org.apache.log4j.FileAppender.setFile(FileAppender.java:294)
    at org.apache.log4j.FileAppender.activateOptions(FileAppender.java:165)
    at org.apache.log4j.DailyRollingFileAppender.activateOptions(DailyRollingFileAppender.java:223)
    at org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:307)
    at org.apache.log4j.xml.DOMConfigurator.parseAppender(DOMConfigurator.java:295)
    at org.apache.log4j.xml.DOMConfigurator.findAppenderByName(DOMConfigurator.java:176)
    at org.apache.log4j.xml.DOMConfigurator.findAppenderByReference(DOMConfigurator.java:191)
    at org.apache.log4j.xml.DOMConfigurator.parseChildrenOfLoggerElement(DOMConfigurator.java:523)
    at org.apache.log4j.xml.DOMConfigurator.parseRoot(DOMConfigurator.java:492)
    at org.apache.log4j.xml.DOMConfigurator.parse(DOMConfigurator.java:1006)
    at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:872)
    at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:778)
    at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:526)
    at org.apache.log4j.LogManager.<clinit>(LogManager.java:127)
    at org.slf4j.impl.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:63)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:281)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:301)
    at org.apache.activemq.jndi.JNDIReferenceFactory.<clinit>(JNDIReferenceFactory.java:39)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at java.lang.Class.newInstance(Class.java:442)
    at org.apache.naming.factory.FactoryBase.getObjectInstance(FactoryBase.java:72)
    at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:839)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:159)
    at org.apache.naming.NamingContextBindingsEnumeration.nextElementInternal(NamingContextBindingsEnumeration.java:117)
    at org.apache.naming.NamingContextBindingsEnumeration.next(NamingContextBindingsEnumeration.java:71)
    at org.apache.naming.NamingContextBindingsEnumeration.next(NamingContextBindingsEnumeration.java:34)
    at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:138)
    at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:145)
    at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:110)
    at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.lifecycleEvent(GlobalResourcesLifecycleListener.java:82)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:94)
    at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:395)
    at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:339)
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:786)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:655)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:355)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:495)
    log4j:ERROR Either File or DatePattern options are not set for appender [CATALINALOG].
  • Hello,

    Can you please do the following:

    Please create file called /etc/logrotate.d/netiq-tomcat and enter the following:

    /opt/netiq/idm/apps/tomcat/logs/catalina.out {
    copytruncate
    daily
    dateext
    dateformat -%Y-%m-%d
    rotate 25
    notifempty
    missingok
    compress
    su novlua novlua
    }

    In order for this to work:
    It is required for the cron service to be running and cron.daily is configured to run in the midnight to rotate the logs.
    In my setup the novlua user and novlua group are the owners of the catalina.out

    The configuration can be validated using the following command:
    /usr/sbin/logrotate -d /etc/logrotate.d/netiq-tomcat

    This is the expected outcome:
    reading config file /etc/logrotate.d/netiq-tomcat

    Handling 1 logs

    rotating pattern: /opt/netiq/idm/apps/tomcat/logs/catalina.out after 1 days (25 rotations)
    empty log files are not rotated, old logs are removed
    switching euid to 485 and egid to 0
    considering log /opt/netiq/idm/apps/tomcat/logs/catalina.out
    log does not need rotating
    switching euid to 0 and egid to 0

    Please modify /opt/netiq/idm/apps/tomcat/conf/logging.properties/

    Please comment out the following lines:

    #handlers = 1catalina.org.apache.juli.AsyncFileHandler,2localhost.org.apache.juli.AsyncFileHandler, 3manager.org.apache.juli.AsyncFileHandler, 4host-manager.org.apache.juli.AsyncFileHandler, java.util.logging.ConsoleHandler
    #.handlers = 1catalina.org.apache.juli.AsyncFileHandler, java.util.logging.ConsoleHandler

    Please add the following line:
    handlers = 2localhost.org.apache.juli.AsyncFileHandler, 3manager.org.apache.juli.AsyncFileHandler, 4host-manager.org.apache.juli.AsyncFileHandler


    Make sure to restart tomcat after this.

    Regards,

    Gerard.