No worries - I understand completely Christian Grobmeier <grobme...@gmail.com> wrote:
THanks for coming back and sorry for not answering so long :-) Busy days :-) On Wed, Oct 20, 2010 at 4:49 PM, Matthew Ishii <matthewis...@vesllc.com> wrote: > I recently discovered that the hierarchy was wrong. > > In order to create a logger one must reference the logger this way: > > log4php.logger.loggername = [loglevel], [appender] > > not > > log4php.rootLogger > ________________________________ > From: Matthew Ishii [matthewis...@vesllc.com] > Sent: Tuesday, October 19, 2010 10:37 AM > To: 'log4php-user@logging.apache.org' > Subject: Cannot get log4php to work properly! > > So I recently discovered that the log4* package was available for PHP and > upon seeing this eagerly downloaded the latest from the log4php website and > followed the installation instructions. The instructions indicate that one > is to download the tar package, untar, and place the following directory in > a place of one's choosing: log4php/src/main/php > > > > Therefore I copied the contents of log4php/src/main/php into my lib dir > under lib/log4php. > > > > In my script, as required, I required the 'Logger.php' class and indicated a > properties file to manage my appenders. The properties file, > log4php.properties, is located on my filesystem at > "/home1/ioforgec/www/devlab/pnotes/config/log4php.properties". > > > > Here is the logfile content: > > > > # > > # Example Logger > > # > > log4php.appender.EA1 = LoggerAppenderConsole > > log4php.appender.EA1.target = STDOUT > > log4php.appender.EA1.layout = LoggerLayoutPattern > > log4php.appender.EA1.ConversionPattern = "%m" > > log4php.appender.EA1.threshold = FATAL > > log4php.exampleLogger = FATAL, EA1 > > > > So here is a copy of my script that implements (more or less 'wraps' the > log4php functionality): > > > > <?php > > > > require_once('/home1/ioforgec/www/devlab/pnotes/lib/log4php/Logger.php'); > > > > class LogUtil > > { > > public $logger; > > public $properties_file = > "/home1/ioforgec/www/devlab/pnotes/config/log4php.properties"; > > > > public static function logExample($msg) > > { > > Logger::configure($properties_file); > > $logger = Logger::getLogger("example"); > > $logger->debug("Shouldnt see this print because of config max level > FATAL"); > > $logger->fatal($msg); > > } > > } > > ?> > > > > In order to test that this is working properly, the following script calls > the LogUtil.php shown above: > > > > #!/usr/bin/php > > <?php > > require_once("lib/utils/LogUtil.php"); > > LogUtil::logExample("example message"); > > ?> > > > > So, despite configuring the example logger to format the messages as the > plain message, despite setting the level of the logger to a max of FATAL, > not only in the logger declaration but also in the threshold command, the > print to the console looks to me like the default root logger: > > > > Mon Oct 18 20:30:05 2010,705 [827] DEBUG example - shouldnt see this print > because of config max level FATAL > > Mon Oct 18 20:30:05 2010,711 [827] FATAL example - example message > > > > I see the print statement without the plain formatting as specified, and I > see two print statements, the debug print (which should never have printed > due to the setting of FATAL on the logger configuration - FATAL is MUCH > higher than DEBUG) > > > > What on earth am I doing wrong? I’ve tried every combination of setup I can > possibly think of. Does anyone have any suggestions? > > > > This message contains information which may be confidential and privileged. Unless you are the addressee (or authorized to receive for the addressee), you may not use, copy or disclose to anyone the message or any information contained in the message. If you have received the message in error, please advise the sender by sending a reply e-mail, and delete the message. Thank you very much.