Although the fix (https://github.com/geoserver/geoserver/pull/5890) did
not make it in time for the 2.21.0 release I did identify and fix the
source of the trouble.

a) The XML configuration format is intended to base case-insensitive for
attribute and element names. This is now fixed.
b) I was not aware that fileName could be optional (as with your example
where the combination of filePattern and DirectWriteRolloverStrategy). This
is also now fixed.

For more information see https://osgeo-org.atlassian.net/browse/GEOS-10487
--
Jody Garnett


On May 6, 2022 at 11:48:50 PM, Jody Garnett <jody.garn...@gmail.com> wrote:

> Excellent, I hope for the upcoming RC that your observation on
> GEOSERVER_LOG_LOCATION on being ignored will be fixed, as long as the
> RollingFileAppender is provided the FilePattern should be updated, I tried
> to recognize when the configuration first starts using -% and fill adjust
> the log location with from settings, with the patterns and extension
> information from the logging profile.
> --
> Jody Garnett
>
>
> On May 6, 2022 at 2:44:34 AM, Calliess Daniel Ing. <
> daniel.calli...@stadt-salzburg.at> wrote:
>
>> Hi Jody,
>>
>>
>>
>> I did some testing with different log4j2 options and came up with a
>> configuration that might also be usefull to others. I downloaded
>> DEFAULT_LOGGING.xml from the new *Custom logging profiles* documentation
>> page and changed the RollingFileAppender to:
>>
>>
>>
>> <RollingFile name="geoserverlogfile">
>>
>>        <FilePattern>X:\logs\geoserver-%d{yyyy-MM-dd}.log</FilePattern>
>>
>>        <PatternLayout pattern="%date{HH:mm:ss} %-6level [%logger{2}] -
>> %msg%n%throwable{filters(org.junit,org.apache.maven,sun.reflect,java.lang.reflect)}"/>
>>
>>        <Policies>
>>
>>              <TimeBasedTriggeringPolicy />
>>
>>        </Policies>
>>
>>        <DirectWriteRolloverStrategy>
>>
>>              <Delete basePath="X:\logs">
>>
>>                     <IfFileName glob="geoserver-*.log" />
>>
>>                     <IfLastModified age="30d" />
>>
>>              </Delete>
>>
>>        </DirectWriteRolloverStrategy>
>>
>> </RollingFile>
>>
>>
>>
>> What this does is:
>>
>> -   Directly write to a log file named after today's date (f.e.
>> *geoserver-2022-05-06.log*).
>>
>> -   When switching to a new filename, all files older than 30 days that
>> match the *geoserver-*.log* expression are deleted.
>>
>>
>>
>> Be aware that when using the DirectWriteRolloverStrategy, the log path
>> set in the *Global Settings* -> *Log Location* is ignored (and maybe
>> also the value set in GEOSERVER_LOG_LOCATION??), i.e. inside the
>> FilePattern the full path to the output folder must be specified.
>>
>>
>>
>> Regards
>> Daniel
>>
>>
>>
>> *From:* Jody Garnett [mailto:jody.garn...@gmail.com]
>> *Sent:* Wednesday, May 4, 2022 5:39 PM
>> *To:* Calliess Daniel Ing. <daniel.calli...@stadt-salzburg.at>
>> *Cc:* GeoServer Users <geoserver-users@lists.sourceforge.net>
>> *Subject:* [EXTERN!]: Re: [Geoserver-users] GeoServer 2.21-M0 milestone
>> available for feedback.
>>
>>
>>
>> Thanks for sharing, if you come up with a log4j 2 example please pass it
>> along for the geoserver docs.
>>
>>
>>
>> The log4j work is now merged and available as a nightly build, and more
>> importantly the documentation is available online.
>>
>> -
>>
>>
>> https://docs.geoserver.org/latest/en/user/configuration/globalsettings.html#logging-settings
>>
>> -
>>
>>
>> https://docs.geoserver.org/latest/en/user/configuration/logging.html#logging
>>
>>
>>
>> In the coming days I will work on making the release candidate (it takes
>> some time as it is when we start the next geoserver release series with new
>> branches and build jobs).
>>
>>
>>
>> Jody
>>
>>
>>
>> On Wed, May 4, 2022 at 2:25 AM Calliess Daniel Ing. <
>> daniel.calli...@stadt-salzburg.at> wrote:
>>
>> Hi Jody,
>>
>>
>>
>> in my environment the size of the logfiles isn't much of a problem. So I
>> configured log4j to act in my personally prefered way, which is to create
>> one file per day and additionally I've got a self-written service running
>> that takes care of cleaning up old (log) files. This is my current
>> configuration:
>>
>>
>>
>> log4j.rootLogger=WARN, geoserverlogfile
>>
>>
>> log4j.appender.geoserverlogfile=org.apache.log4j.rolling.RollingFileAppender
>>
>>
>> log4j.appender.geoserverlogfile.RollingPolicy=org.apache.log4j.rolling.TimeBasedRollingPolicy
>>
>>
>> log4j.appender.geoserverlogfile.RollingPolicy.FileNamePattern=X:/logs/geoserver-%d{yyyy-MM-dd}.log
>>
>> log4j.appender.geoserverlogfile.layout=org.apache.log4j.PatternLayout
>>
>> log4j.appender.geoserverlogfile.layout.ConversionPattern=%d %p [%c{2}] -
>> %m%n
>>
>>
>>
>> For this to work I have to place the Apache Extras™ for Apache log4j™ (
>> https://logging.apache.org/log4j/extras/) library into my *WEB-INF\lib*
>> folder (when using log4j 1.2).
>>
>>
>>
>> Regards
>>
>> Daniel
>>
>>
>>
>>
>>
>> *From:* Jody Garnett [mailto:jody.garn...@gmail.com]
>> *Sent:* Tuesday, May 3, 2022 8:52 AM
>> *To:* Calliess Daniel Ing. <daniel.calli...@stadt-salzburg.at>
>> *Cc:* GeoServer Users <geoserver-users@lists.sourceforge.net>
>> *Subject:* RE: [Geoserver-users] GeoServer 2.21-M0 milestone available
>> for feedback.
>>
>>
>>
>> Thanks for your feedback, I have spent the day addressing this and other
>> feedback made ...
>>
>> ·        Although log4j 1.2 is no longer used, the prior configuration
>> files can be read (sadly this was not working as expected in 2.21-M0 but it
>> is now fixed). I now let Log4J 2 properties configuration try and read the
>> file, and if it is unsuccessful try the log4j 1.2 properties configuration
>> second.
>>
>> ·        I am going to change to renaming, rather than deleting prior
>> properties configuration files (that way they can be recovered if you had a
>> customization that was important to you).
>>
>>
>>
>> I am still curious as the nature of your customization; presently the
>> built-in configurations make 3 backups; but the log4j 2 standard is to
>> compress prior backups (which I think is a good idea).
>>
>>
>>
>> --
>>
>> Jody Garnett
>>
>>
>> On Apr 28, 2022 at 5:21:52 AM, Calliess Daniel Ing. <
>> daniel.calli...@stadt-salzburg.at> wrote:
>>
>> Hi Jody,
>>
>>
>>
>> personally I think that there's no downside to writing out configuration
>> settings to the logfile, but it may come in handy when resolving errors. So
>> I switched the logging level to 'config' in my custom configuration file
>> which works like expected.
>>
>>
>>
>> I'm not quite sure why I would want to use an old "properties"
>> configuration file if log4j 1.2 has been removed from GeoServer. But when
>> renaming such a file and placing it in the <datadir>/logs folder it shows
>> up in the UI. After switching to such a profile I'm unable to see any
>> logging taking place (which I also verified using Sysinternals Process
>> Monitor).
>>
>>
>>
>> As the Global Settings documentation states that *"additional customized
>> profiles can be added by editing the log4j file"*, there might be other
>> users that edited the config files without creating copies of the original
>> files. So I think there should at least be a warning in the release notes
>> that the logging configuration will require attention.
>>
>>
>>
>> Best regards
>>
>> Daniel
>>
>>
>>
>> *From:* Jody Garnett [mailto:jody.garn...@gmail.com]
>> *Sent:* Tuesday, April 26, 2022 7:07 PM
>> *To:* Calliess Daniel Ing. <daniel.calli...@stadt-salzburg.at>
>> *Cc:* GeoServer Users <geoserver-users@lists.sourceforge.net>
>> *Subject:* [EXTERN!]: Re: [Geoserver-users] GeoServer 2.21-M0 milestone
>> available for feedback.
>>
>>
>>
>> That is somewhat expected; they should be CONFIG level logging now. We
>> can adjust CONFIG messages to be shown as part of DEFAULT_LOGGING if they
>> are of interest to you.
>>
>>
>>
>> If you wish to try that out, may a copy of DEFAULT_LOGGING.xml and adjust
>> the geoserver loggers to "config" level.
>>
>>
>>
>> The same approach works for your previous properties files - to preserve
>> any customizations make a copy with a new name. You should still be able to
>> use the log4j 1.2 properties files configurations with this upgrade (indeed
>> it would be great if you could test this as it is a completely different
>> configuration loader). I experimented with only replacing
>> DEFAULT_LOGGING.properties --> DEFAULT_LOGGING.xml if I could recognize
>> that no customizations had been made, but this check was removed in favour
>> of just upgrading based on feedback in GeoServer meeting.
>>
>>
>>
>> Thanks for the useful feedback!
>>
>>
>>
>> Jody
>>
>>
>>
>> On Tue, Apr 26, 2022 at 2:49 AM Calliess Daniel Ing. <
>> daniel.calli...@stadt-salzburg.at> wrote:
>>
>> Hi Jody,
>>
>>
>>
>> I updated my test server from 2.20 to 2.21-M0 using the Windows
>> installer. Basically logging worked, but I'm seeing less logging entries
>> now for the DEFAULT_LOGGING configuration. For example, I'm missing the
>>
>>        ...
>>
>> 2022-04-26 13:46:57,820 INFO [org.geoserver] - Loaded data store '***',
>> enabled
>>
>> 2022-04-26 13:46:59,413 INFO [org.geoserver] - Loaded feature type '***',
>> enabled
>>
>> 2022-04-26 13:46:59,429 INFO [org.geoserver] - Loaded layer '***'
>>
>> ...
>>
>> 2022-04-26 13:47:00,070 INFO [org.geoserver] - Read catalog in 3.422 s
>>
>> 2022-04-26 13:47:00,148 INFO [org.geoserver] - Loaded service
>> 'WMTSInfoImpl--44f35506:159d0de9a1e:-7fff', disabled
>>
>> ...
>>
>> entries after restarting the service. Is this intentional behaviour?
>>
>>
>>
>> Sending the log output to a location outside of the GeoServer
>> installation directory did work as before.
>>
>>
>>
>> My previous *.properties configuration files have been deleted by the
>> installer, which I had changed to reflect my needs (which maybe I shouldn't
>> have done??)
>>
>>
>>
>> Changing the new *.xml configuration files didn't work because they are
>> reset to default after restarting the service. But this isn't a problem
>> because I was able to recreate my previous configuration (simple
>> RollingFile appender with TimeBasedTriggeringPolicy) in a new profile xml
>> file.
>>
>>
>>
>> Switching between profiles works seamlessly without the need to restart
>> the service.
>>
>>
>>
>> Best regards
>>
>> Daniel
>>
>>
>>
>> *From:* Jody Garnett [mailto:jody.garn...@gmail.com]
>> *Sent:* Friday, April 22, 2022 11:05 PM
>> *To:* GeoServer Users <geoserver-users@lists.sourceforge.net>
>> *Subject:* [EXTERN!]: [Geoserver-users] GeoServer 2.21-M0 milestone
>> available for feedback.
>>
>>
>>
>> (Sorry previous email did not format correctly)
>>
>>
>>
>> I have made GeoServer 2.21-M0 milestone “release” here
>>
>> *https://sourceforge.net/projects/geoserver/files/GeoServer/2.21-M0/
>> <https://sourceforge.net/projects/geoserver/files/GeoServer/2.21-M0/>*
>>
>>
>>
>> This release does not even come with an anouncement - only this email!
>> The milestone release is shared to ask for feedback and testing on one
>> feature only - changing to upgrading from log4j 1.2 to log4j 2 (see
>>
>> *http://geoserver.org/behind%20the%20scenes/2022/01/20/log4j-upgrade.html
>> <http://geoserver.org/behind%20the%20scenes/2022/01/20/log4j-upgrade.html>*
>> ).
>>
>>
>>
>> Testing priorites:
>>
>> - Your existing data directory will smoothly update from using log4j 1.2
>> property files to using log4j 2 xml files the first time you run.
>>
>> - Change between the logging profiles on global setting, please let us
>> know if that works directly for you.
>>
>> - Download the user manual and read the docs on making a custom profile
>> if you are keen. Log4j offers fun new capabilities like compressing old log
>> files etc…
>>
>>
>>
>> This is a milestone release, treat as a technology preview not suitable
>> for production use!
>>
>>
>>
>> Thanks to activity sponsors for your support:
>>
>>    - opengeogroep.nl
>>    - www.terrestris.de <https://www.terrestris.de/en/>
>>    - how2map.com
>>    - www.geonovation.nl
>>
>> And thanks to my employer geocat bv for the in-kind support in pursing
>> this upgrade.
>>
>> --
>>
>> --
>>
>> Jody Garnett
>>
>> --
>>
>> --
>>
>> Jody Garnett
>>
>> --
>>
>> --
>>
>> Jody Garnett
>>
>
_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this 
list:
- Earning your support instead of buying it, but Ian Turton: 
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: 
http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: 
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to