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:[email protected]]
Sent: Tuesday, May 3, 2022 8:52 AM
To: Calliess Daniel Ing. <[email protected]>
Cc: GeoServer Users <[email protected]>
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.
<[email protected]<mailto:[email protected]>>
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:[email protected]<mailto:[email protected]>]
Sent: Tuesday, April 26, 2022 7:07 PM
To: Calliess Daniel Ing.
<[email protected]<mailto:[email protected]>>
Cc: GeoServer Users
<[email protected]<mailto:[email protected]>>
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.
<[email protected]<mailto:[email protected]>>
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:[email protected]<mailto:[email protected]>]
Sent: Friday, April 22, 2022 11:05 PM
To: GeoServer Users
<[email protected]<mailto:[email protected]>>
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/
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).
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<https://opengeogroep.nl/>
* www.terrestris.de<https://www.terrestris.de/en/>
* how2map.com<http://how2map.com/>
* www.geonovation.nl<https://www.geonovation.nl/>
And thanks to my employer geocat bv for the in-kind support in pursing this
upgrade.
--
--
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users