Introduction
Log4Twitter is an Appender plug-in for Log4j and Logback that sends log messages to twitter.
With Log4Twitter, you can integrate any application using Log4j or Logback without any modification to the code.
System Requirements
OS: Windows or any flavor of Unix that supports Java.
JVM: JDK1.4.2 or later
Logging Framework: Logback 0.9.6 or later, Log4j 1.2.x or later
How To Use
- Setting Classpath
- Setting Logger
- Optional Settings
Add log4twitter-1.0.jar to your application's classpath.
Note that log4twitter-1.0.jar has to be loaded by the same classloader that will load the logging framework.
Edit your logging framework's configuration to enable Log4Twitter.
The fully qualified class name of log4twitter is "log4twitter.FRAMEWORK_NAME.TwitterAppender".
- A minimal setting for Logback
<configuration> <appender name="twitter" class="log4twitter.logback.TwitterAppender"> <id>YOUR_TWITTER_ID</id> <password>YOUR_TWITTER_PASSWORD</password> <layout class="ch.qos.logback.classic.PatternLayout"> <pattern>%msg%n</pattern> </layout> </appender> <root> <level value="debug" /> <appender-ref ref="twitter" /> </root> </configuration>- A minimal setting for Log4j
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false"> <appender name="twitter" class="log4twitter.log4j.TwitterAppender" > <param name="id" value="YOUR_TWITTER_ID"/> <param name="password" value="YOUR_TWITTER_PASSWORD"/> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%m%n"/> </layout> </appender> <root> <level value="DEBUG"/> <appender-ref ref="twitter"/> </root> </log4j:configuration>Now you are ready to twitter with your own app! You can just run your application as usual.
Option Name | Default Value | Required | Description |
---|---|---|---|
id | N/A | yes | twitter id |
password | N/A | yes | twitter password |
async | true | no | Messages will be logged asynchronously if true(recommended) |
include | N/A | no | Regular Expression positive filter. Messages that matches with this expression will be logged |
exclude | N/A | no | Regular Expression negative filter. Messages that don't match with this expression will be twitterred |
retryCount | 0 | no | Retry Count |
retryIntervalSecs | 10 | no | Retry interval in seconds |
subscribers | N/A | no | Comma separated subscribers list |
Mailing list
Any comment, bug report, feature request or patch is highly welcomed.
Feel free to post messages to the mailing list.
Subscribe to Log4Twitter |
Visit this group |
Go to Jira
License
Log4Twitter is released under the BSD license.Log4Twitter bundles Apache Commons Codec which is released under the Apache Software License .
Log4Twitter bundles Apache Log4j which is released under the Apache Software License .
Log4Twitter bundles Logback which is released under the GNU Lesser General Public License.
Copyright (c) 2007, Yusuke Yamamoto All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the Yusuke Yamamoto nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY Yusuke Yamamoto ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Yusuke Yamamoto BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Pricing
Log4Twitter is an opensourced software and free of charge.You can use Log4Twitter freely for any commercial or non-commercial project.
If you feel Log4Twitter makes your life easier, please do consider making a donation!
Version History
- Version 1.0.1 Added retry count / interval option.
- Version 1.0.0 Released Initial Version
Added an option to enable direct messaging
Todo
- Log4Twiter4Log4net
- Add an option to enable url-tiny-ing.
- fancy logo