[Geoserver-users] log4j issues - how to log?

Hi List,
I’ve been bashing my head against this one for an hour and figure I should probably just ask at this point.
I’ve installed MapFish Print as a separate Jetty servlet. I’m tweaking the geoserver logging file to try and get it to log MapFish Print stuff, ideally to a separate file.

Unfortunately I’m struggling to find documentation for log4j.properties - I suspect geoserver is using log4j 1; the log4j 2 documentation doesn’t reference .properties files.

Anyway, two issues:

  1. (bug?) - Despite what http://docs.geoserver.org/stable/en/user/advanced/logging.html says, placing a new .properties file into the /logs/ directory doesn’t seem to be detected. Anyone else get this? (note: Using Jetty 8)
    (work around - just modify one of the Geoserver ones).

  2. My bigger issue - I can finally get logging happening to a second file, but the logging is identical to that sent to the first file. I only want Mapfish Print stuff going to the second file. But MapFish Print stuff doesn’t seem to be getting logged at all anywhere.

my current file (based on GeoServer_developer_logging.properties) is below. Suggestions welcome.
Thanks,
Jonathan

log4j.rootLogger=WARN, geoserverlogfile, stdout, mapfishlogfile

###############
#Standard output (console)
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{dd MMM HH:mm:ss} %p [%c] - %m%n

###############
GeoServer log File
log4j.appender.geoserverlogfile=org.apache.log4j.RollingFileAppender

Keep three backup files.

log4j.appender.geoserverlogfile.MaxBackupIndex=3

Pattern to output: date priority [category] - message

log4j.appender.geoserverlogfile.layout=org.apache.log4j.PatternLayout
log4j.appender.geoserverlogfile.layout.ConversionPattern=%d %p [%c] - %m%n

###############

log4j.category.log4j=FATAL

log4j.category.org.geotools=WARN
log4j.category.org.geotools.factory=WARN

log4j.category.org.geoserver=TRACE
log4j.category.org.vfny.geoserver=TRACE

log4j.category.org.springframework=WARN

###############
#MapFish log File
log4j.appender.mapfishlogfile=org.apache.log4j.RollingFileAppender
log4j.appender.mapfishlogfile.File=D:/GeoServer_Config_Dir/logs/mapfish-print.log

Keep three backup files.

log4j.appender.mapfishlogfile.MaxBackupIndex=3

Pattern to output: date priority [category] - message

log4j.appender.mapfishlogfile.layout=org.apache.log4j.PatternLayout
log4j.appender.mapfishlogfile.layout.ConversionPattern=%d{ISO8601} [%t] %-5p %30.30c - %m%n
###############

log4j.logger.org.mapfish=DEBUG, mapfishlogfile
log4j.logger.org.pvalsecc=DEBUG, mapfishlogfile

This transmission is intended for the named addressee(s) only and may contain sensitive or protectively marked material up to RESTRICTED and should be handled accordingly. Unless you are the named addressee (or authorised to receive it for the addressee) you may not copy or use it, or disclose it to anyone else. If you have received this transmission in error please notify the sender immediately. All email traffic sent to or from us, including without limitation all GCSX traffic, may be subject to recording and/or monitoring in accordance with relevant legislation.

Jonatan,

Anyway, two issues:

  1. (bug?) - Despite what http://docs.geoserver.org/stable/en/user/advanced/logging.html says, placing a new .properties file into the /logs/ directory doesn’t seem to be detected. Anyone else get this? (note: Using Jetty 8)
    (work around - just modify one of the Geoserver ones).

never tried

  1. My bigger issue - I can finally get logging happening to a second file, but the logging is identical to that sent to the first file. I only want Mapfish Print stuff going to the second file. But MapFish Print stuff doesn’t seem to be getting logged at all anywhere.

After a quick look to your file I think you only have to change this line:

OLD → log4j.rootLogger=WARN, geoserverlogfile, stdout, mapfishlogfile

NEW → log4j.rootLogger=WARN, geoserverlogfile, stdout

This is a working example I’m using for our kibana filter:

KIBANA

log4j.appender.kibanappender=org.apache.log4j.RollingFileAppender
log4j.appender.kibanappender.MaxBackupIndex=7
log4j.appender.kibanappender.layout=org.apache.log4j.PatternLayout
log4j.appender.kibanappender.layout.ConversionPattern=%d %p [%c{2}] %m%n
log4j.logger.org.fao.data.map.geoserver.filter.kibana=INFO,kibanappender

log4j.appender.kibanappender.File=${GEOSERVER_LOG_LOCATION}_kibana

cheers,
Carlo

my current file (based on GeoServer_developer_logging.properties) is below. Suggestions welcome.
Thanks,
Jonathan

log4j.rootLogger=WARN, geoserverlogfile, stdout, mapfishlogfile

###############
#Standard output (console)
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{dd MMM HH:mm:ss} %p [%c] - %m%n

###############
GeoServer log File
log4j.appender.geoserverlogfile=org.apache.log4j.RollingFileAppender

Keep three backup files.

log4j.appender.geoserverlogfile.MaxBackupIndex=3

Pattern to output: date priority [category] - message

log4j.appender.geoserverlogfile.layout=org.apache.log4j.PatternLayout
log4j.appender.geoserverlogfile.layout.ConversionPattern=%d %p [%c] - %m%n

###############

log4j.category.log4j=FATAL

log4j.category.org.geotools=WARN
log4j.category.org.geotools.factory=WARN

log4j.category.org.geoserver=TRACE
log4j.category.org.vfny.geoserver=TRACE

log4j.category.org.springframework=WARN

###############
#MapFish log File
log4j.appender.mapfishlogfile=org.apache.log4j.RollingFileAppender
log4j.appender.mapfishlogfile.File=D:/GeoServer_Config_Dir/logs/mapfish-print.log

Keep three backup files.

log4j.appender.mapfishlogfile.MaxBackupIndex=3

Pattern to output: date priority [category] - message

log4j.appender.mapfishlogfile.layout=org.apache.log4j.PatternLayout
log4j.appender.mapfishlogfile.layout.ConversionPattern=%d{ISO8601} [%t] %-5p %30.30c - %m%n
###############

log4j.logger.org.mapfish=DEBUG, mapfishlogfile
log4j.logger.org.pvalsecc=DEBUG, mapfishlogfile

This transmission is intended for the named addressee(s) only and may contain sensitive or protectively marked material up to RESTRICTED and should be handled accordingly. Unless you are the named addressee (or authorised to receive it for the addressee) you may not copy or use it, or disclose it to anyone else. If you have received this transmission in error please notify the sender immediately. All email traffic sent to or from us, including without limitation all GCSX traffic, may be subject to recording and/or monitoring in accordance with relevant legislation.


Own the Future-Intel® Level Up Game Demo Contest 2013
Rise to greatness in Intel’s independent game demo contest.
Compete for recognition, cash, and the chance to get your game
on Steam. $5K grand prize plus 10 genre and skill prizes.
Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d


Geoserver-users mailing list
Geoserver-users@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

==
Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information.

Dott. Carlo Cancellieri
@cancellieric
Software Engineer

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
mobile: +39 3371094494
fax: +39 0584 1660272

http://www.geo-solutions.it
http://twitter.com/geosolutions_it


Hi Carlo,
Thanks for your reply. Well, your change did stop GeoServer from writing to the MapFish Print log file, which is good.
Unfortunately MapFish itself still isn’t logging anything to anywhere.

I’ve tried:

log4j.logger.org.mapfish =DEBUG, mapfishlogfile
log4j.logger.org.pvalsecc=DEBUG, mapfishlogfile

and

log4j.category.org.mapfish=DEBUG, mapfishlogfile
log4j.category.org.pvalsecc=DEBUG, mapfishlogfile

But neither seem to do anything (just guessing now).


The original MapFish Print log file looks like:

log4j.rootLogger=INFO, R
log4j.appender.R=org.apache.log4j.RollingFileAppender
#log4j.appender.R.File =${catalina.home}/logs/mapfish-print.log
log4j.appender.R.File =/tmp/logs/mapfish-print.log
log4j.appender.R.MaxFileSize=10MB
log4j.appender.R.MaxBackupIndex=10
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%d{ISO8601} [%t] %-5p %30.30c - %m%n

log4j.logger.org.mapfish=DEBUG
log4j.logger.org.pvalsecc=DEBUG
log4j.logger.org.springframework=INFO, R

If I replace the contents of the file with that, I don’t get any logging at all, even to console. It might be a mapfish Print issue, but their documentation is practically non-existent.

Any other thoughts?

Jonathan

On 27 March 2013 13:22, carlo cancellieri <carlo.cancellieri@anonymised.com> wrote:

Jonatan,

Anyway, two issues:

  1. (bug?) - Despite what http://docs.geoserver.org/stable/en/user/advanced/logging.html says, placing a new .properties file into the /logs/ directory doesn’t seem to be detected. Anyone else get this? (note: Using Jetty 8)
    (work around - just modify one of the Geoserver ones).

never tried

  1. My bigger issue - I can finally get logging happening to a second file, but the logging is identical to that sent to the first file. I only want Mapfish Print stuff going to the second file. But MapFish Print stuff doesn’t seem to be getting logged at all anywhere.

After a quick look to your file I think you only have to change this line:

OLD → log4j.rootLogger=WARN, geoserverlogfile, stdout, mapfishlogfile

NEW → log4j.rootLogger=WARN, geoserverlogfile, stdout

This is a working example I’m using for our kibana filter:

KIBANA

log4j.appender.kibanappender=org.apache.log4j.RollingFileAppender
log4j.appender.kibanappender.MaxBackupIndex=7
log4j.appender.kibanappender.layout=org.apache.log4j.PatternLayout
log4j.appender.kibanappender.layout.ConversionPattern=%d %p [%c{2}] %m%n
log4j.logger.org.fao.data.map.geoserver.filter.kibana=INFO,kibanappender

log4j.appender.kibanappender.File=${GEOSERVER_LOG_LOCATION}_kibana

cheers,
Carlo

my current file (based on GeoServer_developer_logging.properties) is below. Suggestions welcome.
Thanks,
Jonathan

log4j.rootLogger=WARN, geoserverlogfile, stdout, mapfishlogfile

###############
#Standard output (console)
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{dd MMM HH:mm:ss} %p [%c] - %m%n

###############
GeoServer log File
log4j.appender.geoserverlogfile=org.apache.log4j.RollingFileAppender

Keep three backup files.

log4j.appender.geoserverlogfile.MaxBackupIndex=3

Pattern to output: date priority [category] - message

log4j.appender.geoserverlogfile.layout=org.apache.log4j.PatternLayout
log4j.appender.geoserverlogfile.layout.ConversionPattern=%d %p [%c] - %m%n

###############

log4j.category.log4j=FATAL

log4j.category.org.geotools=WARN
log4j.category.org.geotools.factory=WARN

log4j.category.org.geoserver=TRACE
log4j.category.org.vfny.geoserver=TRACE

log4j.category.org.springframework=WARN

###############
#MapFish log File
log4j.appender.mapfishlogfile=org.apache.log4j.RollingFileAppender
log4j.appender.mapfishlogfile.File=D:/GeoServer_Config_Dir/logs/mapfish-print.log

Keep three backup files.

log4j.appender.mapfishlogfile.MaxBackupIndex=3

Pattern to output: date priority [category] - message

log4j.appender.mapfishlogfile.layout=org.apache.log4j.PatternLayout
log4j.appender.mapfishlogfile.layout.ConversionPattern=%d{ISO8601} [%t] %-5p %30.30c - %m%n
###############

log4j.logger.org.mapfish=DEBUG, mapfishlogfile
log4j.logger.org.pvalsecc=DEBUG, mapfishlogfile

This transmission is intended for the named addressee(s) only and may contain sensitive or protectively marked material up to RESTRICTED and should be handled accordingly. Unless you are the named addressee (or authorised to receive it for the addressee) you may not copy or use it, or disclose it to anyone else. If you have received this transmission in error please notify the sender immediately. All email traffic sent to or from us, including without limitation all GCSX traffic, may be subject to recording and/or monitoring in accordance with relevant legislation.


Own the Future-Intel® Level Up Game Demo Contest 2013
Rise to greatness in Intel’s independent game demo contest.
Compete for recognition, cash, and the chance to get your game
on Steam. $5K grand prize plus 10 genre and skill prizes.
Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d


Geoserver-users mailing list
Geoserver-users@anonymised.comforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

==
Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information.

Dott. Carlo Cancellieri
@cancellieric
Software Engineer

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
mobile: +39 3371094494
fax: +39 0584 1660272

http://www.geo-solutions.it
http://twitter.com/geosolutions_it


This transmission is intended for the named addressee(s) only and may contain sensitive or protectively marked material up to RESTRICTED and should be handled accordingly. Unless you are the named addressee (or authorised to receive it for the addressee) you may not copy or use it, or disclose it to anyone else. If you have received this transmission in error please notify the sender immediately. All email traffic sent to or from us, including without limitation all GCSX traffic, may be subject to recording and/or monitoring in accordance with relevant legislation.

Jonathan,

I don't know what log4J does as a default but the definition of a max
rollover file-size makes sense.

in your case:
log4j.appender.geoserverlogfile=org.apache.log4j.RollingFileAppender
log4j.appender.geoserverlogfile.MaxBackupIndex=3
*log4j.appender.geoserverlogfile.MaxFileSize=10000KB*

Ceki Gülcü, who was the main author has been careful not to spread too much
information about the log4j configuration, but -fair enough - has written a
slim book in the O'Reilly series, which is worth buying. If mine hadn't
gone walkabout I probably could have told you the default.

Cheers

Christian

-----
____________________________

Dr Christian Maul
Project Manager

Information Services Branch
Department of Sustainability and Environment
Level13, Marland House, 570 Bourke Street
Melbourne 3000

PO Box 500, East Melbourne Vic 3002

Telephone: +61-3-8636 2325
Telefax: +61-3-8636 2813
--
View this message in context: http://osgeo-org.1560.n6.nabble.com/log4j-issues-how-to-log-tp5043285p5043421.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

Hi List,

I’ve been running into an issue when I triy to change the EPSG code of a Raster image already loaded in GS. As soon as I change the EPSG code via Curl the metadata record gets updated for the layer but the layer is no longer available (warning icon). Going via the GS web interface and republishing the layers fixes the issue. My question is: is there a way in the API to ask GS to re-load/re-publish the layer once the EPSG code gets modified?..

I am using GS 2.3.x and Curl

Thanks!

Otto Krauth

Vancouver, BC

Canada

On Sun, Apr 28, 2013 at 8:57 PM, Otto Krauth <okrauth@anonymised.com> wrote:

Hi List,

I've been running into an issue when I triy to change the EPSG code of a
Raster image already loaded in GS. As soon as I change the EPSG code via
Curl the metadata record gets updated for the layer but the layer is no
longer available (warning icon). Going via the GS web interface and
republishing the layers fixes the issue. My question is: is there a way in
the API to ask GS to re-load/re-publish the layer once the EPSG code gets
modified?..

When you say "change the EPSG code", which one are you trying to change?
Only the declared one is really editable

Cheers
Andrea

--

GeoServer training in Milan, 6th & 7th June 2013! Visit
http://geoserver.geo-solutions.it for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------

Hi Andrea,

Yes, I am trying to change the “declared” one via Cirl… the issue I have is that as soon as I do that via REST (Curl) the layer is no longer available, there is a yellow alert triangle next to it when I go and check on the GS web interface. When I open the layer in the web interface and re-publish it with no changes then the layer becomes available. So it looks like all I need to do is reload or reset the layer after making the change to the declared EPSG code. Any ideas how I can do that.

Thanks

Otto Krauth

On 2013-05-01, at 2:00 AM, Andrea Aime wrote:

When you say “change the EPSG code”, which one are you trying to change?
Only the declared one is really editable

Cheers
Andrea