0

Is there any way to configure log4php to output logs only for a given class?

1 Answers1

0

yes, there are two ways.

One is already supported by Log4php. You can configure to only log a specific logger:

log4php.logger.com.foo.Myclass=WARN

The other one is more complicated. You can create your own Filter: http://logging.apache.org/log4php/docs/appender-filter.html

A filter is a class which extends Log4PHP LoggerFilter interface. An example how a filter is implemented can be found here:

http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/filters/LoggerFilterStringMatch.php?view=markup

Cheers, Christian

Christian
  • 7,062
  • 5
  • 36
  • 39