Closed 8w closed 10 years ago
I use xdebug for debugging PHP, and you can pop the breakpoints into Sublime or other IDE for variable lookup, callstack, etc.
I don't have a problem with Log4Php though, just can't work out the benefits over a simple file_put_contents
in combination with xdebug's functionality (or just using the IDE).
There are lots of possible reasons, but these are most relevant to me:
I think it's an important requirement for a framework that will be used for enterprise/ production apps.
I'm happy to add it to my local apps as a pagetool or whatever, but it seems like something that the php.gt framework would be enhanced by if it includes it.
I'll have a look at the popular ones that are out there, might put it into your project to test with before making it a feature
I just opened issue #95 - a great example of why custom logging with config hard-coded into the php is a bad idea!
I started to implement this last night, but got tied-up because I don't remember how class-loading is handled by PHP.Gt. What I did was:
{
"require": {
"apache/log4php": "2.3.0"
},
"prefer-stable": true,
}
./composer.phar install
(which downloads log4php and allows it to be updated by just changing the version number in the composer.json file and re-running composer - see http://logging.apache.org/log4php/download.html).A simple solution that I've seen some PHP apps do is to output logs directly to StdErr / StdOut, which can be read by the OS or PHP at any time.
Does this sound good, or do you think outputting to a file is more desirable?
Neither - I think we need a proper logging framework so it can be increased and decreased at runtime for debugging etc rather than needing code changes. On 31 Jul 2013 09:48, "Greg Bowler" notifications@github.com wrote:
A simple solution that I've seen some PHP apps do is to output logs directly to StdErr / StdOut, which can be read by the OS or PHP at any time.
Does this sound good, or do you think outputting to a file is more desirable?
— Reply to this email directly or view it on GitHubhttps://github.com/g105b/PHP.Gt/issues/94#issuecomment-21848316 .
Just implemented a logger, with similar (but simpler) capabilities to Log4Php.
Use it like this:
// Always obtain a Logger instance. You can name the log file by passing in the name as a parameter to get.
$logger = Log::get();
$logger->info("Here's a log message");
$logger->debug("Here's a debug message", $throwable);
Optionally, a log config file can be used within environments. Put it in APPROOT/Config/Log_Config.cfg.php
, and the following variables can be configured:
I'm leaving this issue open until you've read it, as you made the feature request... does it do what you expect?
Need to update the docs to show the config file format/ example Does the implementation allow logging to be configured for particular classes/ namespaces/ PageCode/ PageTool directory hierarchies? So if I was trying to debug an issue in authentication or a particular pagetool I would want to be able to turn up logging on that part of the codebase but not the whole application. If it applies to the whole application level it would be really difficult to see what you wanted.
Would you be prepared to add a logging framework (such as Log4Php ) to PhpGt? debugging my own php code is very difficult without it (var dump and die is very blunt), and there's not much sense in trying to reinvent the wheel when php4j is a fully fledged Apache project.