Firebug tip: Log DOM Events
This Firebug feature is called simply Log Events and allows developers to log DOM events into the Console panel.
All you need to do is right click on an element in the HTML panel, pick Log Events from the context menu and switch to the Console panel to see the logs in action.
Related cards:
How to: Apache logs on a daily basis without logrotate
If you want to have a new log file every day automatically, but avoid using logrotate
, the CustomLog
directive is your friend:
CustomLog "|/usr/sbin/rotatelogs /opt/www/awesome-project/log/access.%Y-%m-%d.log 86400" combined
Adding that ...
SAML Single Logout (SLO)
There are two ways a logout in SAML can happen: Service Provider (SP) initiated and Identity Provider (IDP) initiated logout. I'll explain how to implement both flows with devise_saml_authenticatable
.
Note
SAML also supports a `S...
Parse & sort unique hits in logfiles
If you want to know the exact hits on your website (or whatever logfile you want) for a specific date without duplicates, here's how.
"Unique" means you don't want to count hits to an URL originating from the same IP twice.
You can use the attach...
Using Firebug Lite to inspect HTML in Internet Explorer and other browsers
You know Firebug as a Firefox extension but there is also a "Lite" version which runs purely off JavaScript.
Though all major browsers offer inspection tools you may like the Firebug style. Also, for me this is a lot better than the IE8 develop...
Custom loggers in Ruby and Rails
File logger
If you need to log to a file you can use Ruby's Logger
class:
require 'logger'
log = Logger.new('log/mylog.log')
log.info 'Some information'
log.debug 'Debugging hints'
log.error StandardError.new('Something went wrong')
```...
How to rotate log files explicitly
Usually, the logrotate
service takes care of renaming log files each night or so to avoid logs becoming huge. That will rename your.log
to your.log.1
, the next time to your.log.2.gz
, etc. Here is how to make that happen out of band (you sh...
Don't use log level :debug in your production environments
Catch phrase
You don't want sensitive user data in your logs.
Background
Rails per default filters sensitive data like passwords and tokens and writes [FILTERED]
to the logs. The code which is responsible for enabling that usually lives...
How to include Sidekiq job IDs in Rails logs
When logging in Rails, you can use the log_tags
configuration option to add extra information to each line, like :request_id
or :subdomain
. However, those ...
Capistrano task to tail remote application logs of multiple servers
When your application is running on a multi-server setup, application logs are stored per server (unless you choose a centralized logging solution).
Here is a Capistrano task that connects to all servers and prints logs to your terminal like this:...
Apache: Log the original client IP when your site sits behind a reverse proxy
When your site is mapped into the URL-space of another server using mod_proxy
, ProxyPass
and ProxyPassReverse
, all requests in your Apache logs are logged with the IP address of the proxying server. The IP address of the original client doin...