[GeoNetwork-devel] debug log messages are computationally expensive

Hi,

In many of our debug logs we do things like:

Log.debug(Log.JEEVES, "message: "+Xml.getString(xml));

This can be very computationally expensive if xml is large. That is fine when in debug mode, unfortunately Xml.getString(xml) is done even when not in debug mode.

Sometime ago I added Log.isDebug(…) so a check can be made before doing an debug log. Last night I started a sweep through the code adding the guard to each debug statement.

Before doing more I wanted to make sure when I am done I can commit the work. (I will request a review when done).

Does anyone have any problems with this idea?

Jesse

Hi Jesse

For me seem a very good idea.

Regards,
Jose García

On Thu, Apr 5, 2012 at 7:42 AM, Jesse Eichar <jesse.eichar@anonymised.com> wrote:

Hi,

In many of our debug logs we do things like:

Log.debug(Log.JEEVES, "message: "+Xml.getString(xml));

This can be very computationally expensive if xml is large. That is fine when in debug mode, unfortunately Xml.getString(xml) is done even when not in debug mode.

Sometime ago I added Log.isDebug(…) so a check can be made before doing an debug log. Last night I started a sweep through the code adding the guard to each debug statement.

Before doing more I wanted to make sure when I am done I can commit the work. (I will request a review when done).

Does anyone have any problems with this idea?

Jesse


Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev


GeoNetwork-devel mailing list
GeoNetwork-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geonetwork-devel
GeoNetwork OpenSource is maintained at http://sourceforge.net/projects/geonetwork


GeoCat Bridge for ArcGIS allows instant publishing of data and metadata on GeoServer and GeoNetwork. Visit http://geocat.net for details.


Jose García
GeoCat bv
Veenderweg 13
6721 WD Bennekom
The Netherlands
http://GeoCat.net

I have made a ticket for this.

http://trac.osgeo.org/geonetwork/ticket/852

If I could get a quick review I would appreciate it. I think it is fairly low risk. No functional changes. I double checked that I got all the module names right.

jesse

On Thu, Apr 5, 2012 at 7:42 AM, Jesse Eichar <jesse.eichar@anonymised.com> wrote:

Hi,

In many of our debug logs we do things like:

Log.debug(Log.JEEVES, "message: "+Xml.getString(xml));

This can be very computationally expensive if xml is large. That is fine when in debug mode, unfortunately Xml.getString(xml) is done even when not in debug mode.

Sometime ago I added Log.isDebug(…) so a check can be made before doing an debug log. Last night I started a sweep through the code adding the guard to each debug statement.

Before doing more I wanted to make sure when I am done I can commit the work. (I will request a review when done).

Does anyone have any problems with this idea?

Jesse

Great ! Just one comment : how about naming it isDebugEnabled() ? Then it’d look more like the normal logging libraries that all other software uses. It’ll be more easy to find for other developers.

Heikki

On Thu, Apr 5, 2012 at 8:58 AM, Jesse Eichar <jesse.eichar@anonymised.com…> wrote:

I have made a ticket for this.

http://trac.osgeo.org/geonetwork/ticket/852

If I could get a quick review I would appreciate it. I think it is fairly low risk. No functional changes. I double checked that I got all the module names right.

jesse

On Thu, Apr 5, 2012 at 7:42 AM, Jesse Eichar <jesse.eichar@anonymised.com…> wrote:

Hi,

In many of our debug logs we do things like:

Log.debug(Log.JEEVES, "message: "+Xml.getString(xml));

This can be very computationally expensive if xml is large. That is fine when in debug mode, unfortunately Xml.getString(xml) is done even when not in debug mode.

Sometime ago I added Log.isDebug(…) so a check can be made before doing an debug log. Last night I started a sweep through the code adding the guard to each debug statement.

Before doing more I wanted to make sure when I am done I can commit the work. (I will request a review when done).

Does anyone have any problems with this idea?

Jesse


Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev


GeoNetwork-devel mailing list
GeoNetwork-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geonetwork-devel
GeoNetwork OpenSource is maintained at http://sourceforge.net/projects/geonetwork

Good suggestion. I will do that.

On Thu, Apr 5, 2012 at 11:15 AM, heikki <tropicano@anonymised.com> wrote:

Great ! Just one comment : how about naming it isDebugEnabled() ? Then it’d look more like the normal logging libraries that all other software uses. It’ll be more easy to find for other developers.

Heikki

On Thu, Apr 5, 2012 at 8:58 AM, Jesse Eichar <jesse.eichar@anonymised.com> wrote:

I have made a ticket for this.

http://trac.osgeo.org/geonetwork/ticket/852

If I could get a quick review I would appreciate it. I think it is fairly low risk. No functional changes. I double checked that I got all the module names right.

jesse

On Thu, Apr 5, 2012 at 7:42 AM, Jesse Eichar <jesse.eichar@anonymised.com> wrote:

Hi,

In many of our debug logs we do things like:

Log.debug(Log.JEEVES, "message: "+Xml.getString(xml));

This can be very computationally expensive if xml is large. That is fine when in debug mode, unfortunately Xml.getString(xml) is done even when not in debug mode.

Sometime ago I added Log.isDebug(…) so a check can be made before doing an debug log. Last night I started a sweep through the code adding the guard to each debug statement.

Before doing more I wanted to make sure when I am done I can commit the work. (I will request a review when done).

Does anyone have any problems with this idea?

Jesse


Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev


GeoNetwork-devel mailing list
GeoNetwork-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geonetwork-devel
GeoNetwork OpenSource is maintained at http://sourceforge.net/projects/geonetwork