Details

    • Type: Improvement
    • Status: Closed
    • Priority: Low
    • Resolution: Fixed
    • Affects versions: None
    • Fix versions: 2.7.3, 2.8.0
    • Components: Main
    • Labels:
      None

      Description

      In https://github.com/geoserver/geoserver/blob/master/src/main/src/main/java/org/geoserver/logging/LoggingUtils.java#L81 the code enforces the use of the RollingFileAppender when logging, while one might want to use a DailyRollingFileAppender.

      It is still possible but you have to specify the File property directly in the .properties file instead of relying on the one set in logging.xml - which is a bit annoying since some warnings are spewed in the log.

      log4j.appender.geoserverlogfile=org.apache.log4j.DailyRollingFileAppender
      log4j.appender.geoserverlogfile.DatePattern='.'yyyy-MM-dd
      log4j.appender.geoserverlogfile.File=/srv/log/tomcat/geoserver.log
      

      It would be nice to allow DailyRollingFileAppender to be used (and still rely on the globally set logfile path) - probably by changing the check for being instanceof org.apache.log4j.FileAppender which should match both RollingFileAppender and DailyRollingFileAppender.

      --- a/src/main/src/main/java/org/geoserver/logging/LoggingUtils.java
      +++ b/src/main/src/main/java/org/geoserver/logging/LoggingUtils.java
      @@ -74,7 +74,7 @@ public class LoggingUtils {
                   // configuring the log4j file logger
                   if(!suppressFileLogging) {
                           Appender gslf = org.apache.log4j.Logger.getRootLogger().getAppender("geoserverlogfile");
      -                    if (gslf instanceof org.apache.log4j.RollingFileAppender) {
      +                    if (gslf instanceof org.apache.log4j.FileAppender) {
                               if (logFileName == null ) {
                                   logFileName = new File(loader.findOrCreateDirectory("logs"),  "geoserver.log").getAbsolutePath();
                               } else { 
      @@ -87,7 +87,7 @@ public class LoggingUtils {
                               PropertyConfigurator.configure(lprops);
                               LoggingInitializer.LOGGER.fine("Logging output to file '" + logFileName + "'");
                           } else if (gslf != null) {
      -                        LoggingInitializer.LOGGER.warning("'log4j.appender.geoserverlogfile' appender is defined, but isn't a RollingFileA
      +                        LoggingInitializer.LOGGER.warning("'log4j.appender.geoserverlogfile' appender is defined, but isn't a FileAppender
                           } else {
                               LoggingInitializer.LOGGER.warning("'log4j.appender.geoserverlogfile' appender isn't defined.  GeoServer won't cont
                           }
      
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              landry Landry Breuil
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 5 minutes
                5m
                Remaining:
                Remaining Estimate - 5 minutes
                5m
                Logged:
                Time Spent - Not Specified
                Not Specified