Community contributed extensions

Play! Framework Log4Play Module

Felipe Oliveira & Deepthi Rallabandi
http://playframework.info
http://geeks.aretotally.in
http://mashup.fm
http://twitter.com/_felipera

1) Introduction

Log4Play is a module that provides a log4j appender which publishes log entries to an EventStream.
The module also provides an user interface which uses a WebSocket creating a live stream of log messages.
You can use this user interface to look at the logs of your application without needing to login to the actual box.
If you would like to turn off log4play globally or on a specific mode (production for example) then just define a configuration property ‘log4play.disabled=true’.
Log4Play comes bundled with BetterLogs so you can also turn that off by adding ‘betterlogs.disabled=true’ to your configuration (conf/application.conf).

2) Installation

Under dependencies.yml:

require:
- play -> log4play 0.4

3) Live Demo

A live demo is available at http://log4play.mashup.fm:9030/@logs.
As soon as you enable the module on your application you should have the same UI available as well under /@logs.

4) Source Code

The source code is available on Github at https://github.com/feliperazeek/log4play.

5) Changelog

May 13th 2011 – Version 0.1: First Release.
May 15th 2011 – Version 0.2: Code Cleanup.
May 17th 2011 – Version 0.3: BetterLogs Integration. Firefox 4 Info provided by Diogenes Buarque.
Jun 22nd 2011 – Version 0.4: Adding log4play.disabled configuration option, adding max number of log entries in the UI

6) Misc

Thank you Diogenes Buarque for the following (Boa Diogenes – Valeu!):
"For those who want to use the awesome log4play in firefox 4, you must enable the use of websockets.
http://wiki.mibbit.com/index.php/Websocket"

7) Implementation

For more details regarding the implementation of this module please go to http://geeks.aretotally.in/log4play-log4j-ui-mashed-up-with-play-framework-knockout-js-and-websockets.

8) BetterLogs Integration

Log4Play integrates with BetterLogs module (http://www.playframework.org/modules/betterlogs), great module created by Stephane Godbillon. This is how Stephane defines her creation:
"This very simple module enhances the Play! Framework logs to bring some missing information such as the class name, the method name where the log has been called, its signature, the file name and the line."

9) Roadmap