Clogger Clogger::Format

clogger v2.2.0 - Rack 2.x compatibility fix / 2017-05-23 08:40 UTC

This release fixes a Rack compatibility problem when
Rack::BodyProxy wraps the Clogger object and calls
"respond_to?" with two arguments.  This affects folks
who put Clogger at lower levels of the middleware stack
(below middlewares which use Rack::BodyProxy)

A huge thanks to Pat Allan for coming up with this fix.

Note, the recommended usage of clogger middleware is to have
it at the outermost layer of the Rack middleware stack where
it can give the most accurate $request_time measurement.

There's also a couple of tiny internal improvements
around the build and miniscule GC overhead reduction.

Pat Allan (1):
      Update respond_to? calls for second argument.

Eric Wong (3):
      clogger.c: comment to explain the lack of GC guard
      ext: reduce frozen string marking overhead
      build: remove build-time olddoc dependency

clogger 2.1.0 - rack 2.x compatibility and more! / 2016-07-28 02:18 UTC

5 changes since 2.0.2:
      test_clogger: add test for REMOTE_USER
      ext: avoid clobbering existing system functions
      pure: remove Rack::Utils.bytesize dependency
      loosen rack dependency to allow rack 2.x
      doc use HTTPS for URLs and move homepage

Note the new homepage:

code: git clone
mail archives:
email us and our archives:

Coming soon:
- hidden service mirrors for the homepage + git host
- POP3 mailing list subscriptions!

clogger 2.0.2 - bugfixes for pure Ruby users / 2015-02-27 22:54 UTC

This release fixes a bug discovered in the rarely-used pure Ruby
version in multithreaded Rack servers.

Some folks reported privately that they forgot to upgrade from
clogger 1.0.1 when when upgrading from MRI 1.9.3 to 2.1, so they
were inadvertently using the pure Ruby version instead of the
less-buggy C extension.  This also adds support for using the
monotonic clock under Ruby 2.1+ for request timing, matching
what the C extension used all along.

Users of the C extension are unaffected by bugs this release fixes
and do not need to upgrade.

* pure: fix reentrancy of request_time
* pure: use monotonic clock if possible

clogger 2.0.1 - doc updates and new mailing list / 2015-01-13 02:54 UTC

Most notably, there's a new mailing list at

You may (optionally) subscribe to the new mailing list at:

If you're on librelist, you'll need to subscribe manually since
librelist subscribers cannot be imported.  Of course, you do not
have to be subscribed to post, either (please Cc: everyone as folks
may not be subscribed).

      README: document $env support for reading Rack env
      switch docs + website to olddoc
      ext: get rid of noisy and unnecessary cast
      new mailing list at
      gemspec: use SPDX license abbreviation
      remove Rubyforge reference in Rakefile

clogger 2.0.0 - updated website URL, cleanups / 2014-05-12 06:50 UTC

This updates the documentation to point to the new homepage

There is one API change which removes :to_io support,
as this was never a valid Rack extension.

This also fixes a minor incompatibility which prevented the GVL from
being released on ruby-trunk (2.2.0dev) during disk operations.

The mailing list continues to be hosted at librelist, but that will
probably soon change to a public-inbox + mailing list.

There are also minor code cleanups.

This also relaxes license to LGPLv2.1 or later.

clogger 1.4.0 - updated website URL, cleanups / 2014-05-12 06:30 UTC

This updates the documentation to point to the new homepage

This also fixes a minor incompatibility which prevented the GVL from
being released on ruby-trunk (2.2.0dev) during disk operations.

The mailing list continues to be hosted at librelist, but that will
probably soon change to a public-inbox + mailing list.

There are also minor code cleanups.

clogger 1.3.0 - avoid RARRAY_PTR usage / 2013-09-26 23:39 UTC

This release only affects users of the C extension.  Users of
the pure Ruby code are not affected.

  * avoid RARRAY_PTR usage for RGenGC in Ruby 2.1.0

    I have not benchmarked this, but this is unlikely to be a bottleneck
    at all in older Rubies.  It results in a smaller binary, too, which
    will help with icache bloat.  This should also improve performance
    under Rubinius, too.

clogger 1.2.0 - small bug and compatibility fixes / 2012-11-06 03:01 UTC

This release enables the optional C extension on MRI Ruby 2.0.0
(and any other platform that builds C extensions).

For rare setups which do not specify a :logger or :path
parameter for Clogger#initialize, we are now Rack::Lint
compliant and call #write on env["rack.errors"] instead
of "<<"

clogger 1.1.0 - more escaping! / 2011-12-06 02:58 UTC

This release fixes potential vulnerabilities when escape
sequences are viewed in certain terminals.

The 0x7F-0xFF byte range is escaped to match behavior of nginx
1.0.9+, as some character sets may have escape characters in
that range.

$cookie_* values are now escaped to be consistent with the
behavior of the $http_cookie value.  All users of $cookie_* in
their log format must upgrade (of course there may be no
Clogger users other than myself, and I don't use $cookie_*)

clogger 1.0.1 - portability fixes / 2011-06-22 21:45 UTC

Minor portability fixes noticed on some systems.

There is a minor license change, it is now explicitly LGPLv2.1
and LGPLv3 and later versions at the project leader's
discretion.  It is no longer LGPLv2.1+, so it doesn't give a
blank check to the FSF to change the license on us.

clogger 1.0.0 - o/ / 2011-04-21 05:42 UTC

* $time_iso8601 added for nginx compatibility
* $time_local (without strftime-options) is now locale-independent

There's also a minor usability tweak that allows Symbols to be
specified as the :format argument, so can be shortened:

before (continues to work with 1.0.0):

    use Clogger, :format => Clogger::Format::Rack_1_0


    use Clogger, :format => :Rack_1_0

clogger 0.9.0 - configurable logging for Rack / 2011-03-15 11:53 UTC

Under 1.9, we always release the GVL for filesystem operations
now to avoid worst case scenarios.  This may hurt performance
for some folks with bad locking implementations and extremely
fast filesystems.  A couple of minor cleanups, too.

clogger 0.8.0 - delegating away! / 2011-01-21 09:09 UTC

Clogger now delegates all unknown methods to the response body
in cases where it needs to wrap the response body.  This allows
apps that use non-standard Rack extensions to continue working.

Eric Wong (4):
      pass along "to_io" calls to the body
      delegate method_missing calls to the response body
      pure: simpler autoload trigger
      switch to for maintenance tasks

clogger 0.7.0 - portability improvements, cleanups / 2011-01-15 00:39 UTC

Broken/crazy systems without CLOCK_MONOTONIC (in varying
degrees) and/or clock_gettime() should be supported by
using gettimeofday().  Thanks to Lawrence Pit for reporting
and helping us test.

The Clogger::ToPath proxy class is gone, Clogger itself can
proxy to_path/close calls correctly to the response body.

$time_utc with a default strftime-format is now supported, and
time formats can now be arbitrarily long in the C extension.

clogger 0.6.0 - :path shortcut, minor bugfixes / 2010-12-25 09:28 UTC

Clogger may now be initialized with a :path instead of :logger
to avoid typing "::File" in files to avoid conflicting
with the completely-unrelated Rack::File.

$request_time is now uses the monotonic clock, making it immune
to system clock changes.  $usec and $msec statements were
completely broken in the pure-Ruby code and now fixed.

Rubinius is supported by the optional C extension as well,
the pure-Ruby code always worked.

clogger 0.5.0 - body.to_path forwarding / 2010-06-06 07:59 UTC

This release allows middleware like Rack::Contrib::Sendfile to
work properly higher up the stack from Clogger.

Certain configurations of the Rainbows! and Zbatery web servers
are able to use the return value of body.to_path to serve static
files efficiently (via IO.copy_stream under 1.9 or
stream_file_data with EventMachine).

There are some small cleanups and documentation improvements
as well.

I've relicensed to LGPLv2.1+ (from LGPLv3-only) to allow
bundling with GPLv2-only applications (I'm currently the sole
copyright holder).

Signed-off-by: Eric Wong <>

clogger 0.4.0 / 2010-04-21 23:54 UTC

Small cleanups and minor enhancements (mainly for the optional
C extension) for this release:

Eric Wong (10):
      ext: use FIX macros instead of generic NUM macros if possible
      ext: preserve subclasses of Rack::Utils::HeaderHash
      test: fix Linux memory usage test
      avoid direct require of "rack" to quiet warnings
      ext: GC safety fix when throwing an exception
      ext: eliminate unused variable
      ext: fix signedness and shadow warnings
      ext: sparse cleanups
      ext: avoid void pointer arithmetic
      clogger 0.4.0

clogger 0.3.2 / 2010-02-13 09:48 UTC

This release fixes a memory leak in the optional C extension due to
misuse of the Ruby C API.  Users of the pure Ruby version are

We also misreleased 0.3.1 with this fix, but without bumping the
Clogger::VERSION constant.

clogger 0.3.1 / 2010-02-13 09:38 UTC

This release fixes a memory leak in the optional C extension due to
misuse of the Ruby C API.  Users of the pure Ruby version are

clogger 0.3.0 / 2010-02-09 22:04 UTC

You may now force the :reentrant flag to +true+ or +false+ in
your Rack configuration file:

   use Clogger,
       :format => Clogger::Format::Combined,
       :logger =>"/path/to/log", "ab"),
       :reentrant => true

This is to be compatible with Rack servers that do not use use
events or Fibers for concurrency instead of threads.  By
default, reentrancy is enabled if env["rack.multithread"] is
true, but "rack.multithread" cannot indicative of a reentrancy
requirement in a web server.

clogger 0.2.0 / 2010-01-07 02:03 UTC

The optional C extension no longer tries to preserve the
original response array as it could become subtly broken by
people using non-frozen but constant responses.  For the pure
Ruby version, there is a 1.9-encoding bugfix for response
size calculation.

clogger 0.1.0 / 2009-10-06 20:49 UTC

This release should help ensure compatibility with a
to-be-released version of Rack::Lint that allows subclasses of
the core String and Hash objects for users of the optional C

Eric Wong (6):
      ext: convert non-Hashes #to_hash if possible
      ext: ensure all objects we byte_xs are Strings
      tests for subclassing
      gemspec: disable the license= field for older RubyGems
      GNUmakefile: fix grammar FAIL in comment
      cleanup packaging and website/rdoc

clogger 0.0.7 / 2009-09-09 17:13 UTC

We now properly handle bodies that do not respond to the :close
method.  Additionally there small documentation/formatting

clogger 0.0.6 / 2009-09-07 23:59 UTC

"clogger_ext" is no longer a separate gem, but merged into the
"clogger" gem itself.  The installation should automatically
detect compatible versions of Ruby and only build the C
extension for MRI 1.8/1.9.

Rack::Utils::HeaderHash is now used for $sent_http_* variable
lookups instead of a hand-rolled solution.  HeaderHash objects
should be reusable in Rack soon to avoid the penalty of
recreating them repeatedly in middlewares and hopefully
more-widely used as a result.

Underlying logger objects are sync=true for safety reasons.
This has always been the case for the C extension version
when writing to regular files.

Other small changes include more CGI variables and the :ORS
(output record separator) option added (default: "\n").

clogger 0.0.5 / 2009-09-03 01:45 UTC

The following variables are now exposed: $request_method,
$content_length and $content_type.  Additionally, attempts
to use $http_content_length or $http_content_type will be
remapped to use the non-"$http_"-prefixed variable instead
since the "$http_"-variants of those variables is not allowed
by Rack.

clogger 0.0.4 / 2009-09-02 08:04 UTC

The pure Ruby version now escapes with uppercase A-F
characters to match nginx log output.  There are now extra
checks against badly behaving Rack applications and 500
errors will be logged before TypeError is raised if the
application response does not conform (minimally) to Rack
expectations.  Finally, handling of $request (requests
without "HTTP_VERSION" set in the Rack env) should now be
logged correctly without unnecessary trailing characters.

Hackers: the primary git repository has been moved to
git:// for now since I'm having
issues with pushing to Rubyforge (seems related to Support
Requests item #26185).

clogger 0.0.3 / 2009-08-29 23:20 UTC

The MRI extension clogger_ext gets GC bug fix and
cleanups/robustness improvements.  It should now be more
tolerant of misbehaving applications in that it'll be less
likely to segfault.  No changes to the (recommended) pure

clogger 0.0.2 / 2009-08-29 20:53 UTC

The $request_uri variable (as documented in the README) is now
implemented.  Those using C extension could potentially segfault
if the app returned an invalid response; we now log 500 errors
in their place.

clogger 0.0.1 / 2009-08-29 04:47 UTC

initial release

mail archives:
source code: git clone git://
	git clone