我正在尝试在我的php应用程序中使用log4php。像log4j一样,这可以将日志写入控制台或日志文件。有点混淆如何与heroku日志记录接口。理想情况下,我希望能够通过从工具带运行heroku -log来查看日志语句,但似乎无法弄清楚如何配置log4php来完成此任务。
这是我设置为写入控制台的log_config.xml
<?xml version="1.0"?>
<log4php:configuration xmlns:log4php="http://logging.apache.org/log4php/">
<appender name="default" class="LoggerAppenderConsole">
<layout class="LoggerLayoutPattern">
<param name="ConversionPattern" value="%d{Y-m-d H:i:s} [%p] %c: %m (at %F line %L)%n" />
</layout>
</appender>
<appender name="fileLogger" class="LoggerAppenderFile">
<param name="file" value="c:/_logs/php_error.log" />
<layout class="LoggerLayoutPattern">
<param name="ConversionPattern" value="%d{Y-m-d H:i:s} [%p] %c: %m (at %F line %L)%n" />
</layout>
</appender>
<root>
<level value="DEBUG" />
<appender_ref ref="default" />
</root>
<logger name="myLogger" additivity="true">
<level value="ALL" />
</logger>
</log4php:configuration>
但是当我通过heroku工具带访问日志时,我看到的就是apache访问日志,其中包含以下内容,而且我的应用程序没有生成任何调试语句
←[33m2012-12-30T13:45:57+00:00 heroku[router]:←[0m at=info method=GET path=/givefly/src/actions/get_thumbnails.php?searchTerm=fire&isUrl=false host=still-castle-2245.herokuapp.com fwd=121.7.1.191 dyno=web.1 queue=0 wait=0ms connect=2ms service=10117ms status=200 bytes=29
←[33m2012-12-30T13:46:25+00:00 heroku[router]:←[0m at=info method=GET path=/givefly/src/actions/get_page_title.php?url=www.pepsi.com host=still-castle-2245.herokuapp.com fwd=121.7.1.191 dyno=web.1 queue=0 wait=0ms connect=1ms service=401ms status=200 bytes=48
←[33m2012-12-30T13:46:25+00:00 heroku[router]:←[0m at=info method=GET path=/givefly/src/actions/get_thumbnails.php?searchTerm=www.pepsi.com&isUrl=true host=still-castle-2245.herokuapp.com fwd=121.7.1.191 dyno=web.1 queue=0 wait=0ms connect=1ms service=237ms status=500 bytes=0
←[33m2012-12-30T13:44:54+00:00 heroku[router]:←[0m at=info method=GET path=/givefly/src/static/homepage.css host=still-castle-2245.herokuapp.com fwd=121.7.1.191 dyno=web.1 queue=0 wait=0ms connect=1ms service=3ms status=200 bytes=2457
←[33m2012-12-30T13:44:58+00:00 heroku[router]:←[0m at=info method=GET path=/givefly/lib/jquery/noty/themes/default.js host=still-castle-2245.herokuapp.com fwd=121.7.1.191 dyno=web.1 queue=0 wait=0ms connect=1ms service=13ms status=200 bytes=9391
←[33m2012-12-30T13:44:58+00:00 heroku[router]:←[0m at=info method=GET path=/givefly/lib/jquery/jquery-impromptu.js host=still-castle-2245.herokuapp.com fwd=121.7.1.191 dyno=web.1 queue=0 wait=0ms connect=0ms service=3ms status=200 bytes=14772
←[35m2012-12-30T13:58:02+00:00 heroku[api]:←[0m Starting process with command `bash` by ashnil.dixit@gmail.com
←[31m2012-12-30T13:58:04+00:00 heroku[run.2213]:←[0m Starting process with command `bash`
←[31m2012-12-30T13:58:04+00:00 heroku[run.2213]:←[0m Awaiting client
←[31m2012-12-30T13:58:04+00:00 heroku[run.2213]:←[0m State changed from starting to up
←[31m2012-12-30T14:01:07+00:00 heroku[run.2213]:←[0m Client connection closed. Sending SIGHUP to all processes
←[31m2012-12-30T14:01:08+00:00 heroku[run.2213]:←[0m Process exited with status 129
←[31m2012-12-30T14:01:07+00:00 heroku[run.2213]:←[0m Client connection closed. Sending SIGHUP to all processes
←[31m2012-12-30T14:01:21+00:00 heroku[run.3834]:←[0m Awaiting client
←[31m2012-12-30T14:01:21+00:00 heroku[run.3834]:←[0m Starting process with command `bash`
←[31m2012-12-30T14:01:22+00:00 heroku[run.3834]:←[0m State changed from starting to up
←[35m2012-12-30T14:01:17+00:00 heroku[api]:←[0m Starting process with command `bash` by ashnil.dixit@gmail.com
←[31m2012-12-30T14:01:08+00:00 heroku[run.2213]:←[0m State changed from up to complete