Logging POST data from $request_body

This solution works like a charm: http { log_format postdata $request_body; server { location = /post.php { access_log /var/log/nginx/postdata.log postdata; fastcgi_pass php_cgi; } } } I think the trick is making nginx believe that you will call a CGI script. Edit 2022-03-15: there is some discussion on where log_format should be set. The documentation clearly … Read more

Best way to log POST data in Apache?

Use Apache’s mod_dumpio. Be careful for obvious reasons. Note that mod_dumpio stops logging binary payloads at the first null character. For example a multipart/form-data upload of a gzip’d file will probably only show the first few bytes with mod_dumpio. Also note that Apache might not mention this module in httpd.conf even when it’s present in … Read more

Spring Boot: How can I set the logging level with application.properties?

Update: Starting with Spring Boot v1.2.0.RELEASE, the settings in application.properties or application.yml do apply. See the Log Levels section of the reference guide. logging.level.org.springframework.web: DEBUG logging.level.org.hibernate: ERROR For earlier versions of Spring Boot you cannot. You simply have to use the normal configuration for your logging framework (log4j, logback) for that. Add the appropriate config … Read more

When to use the different log levels

I generally subscribe to the following convention: Trace – Only when I would be “tracing” the code and trying to find one part of a function specifically. Debug – Information that is diagnostically helpful to people more than just developers (IT, sysadmins, etc.). Info – Generally useful information to log (service start/stop, configuration assumptions, etc). … Read more

How to log cron jobs?

* * * * * myjob.sh >> /var/log/myjob.log 2>&1 will log all output from the cron job to /var/log/myjob.log You might use mail to send emails. Most systems will send unhandled cron job output by email to root or the corresponding user.