Sunday, March 1, 2009

Log4erl v. 0.8.4 is out with SMTP logs

Hi,

Today, version 0.8.4 has been released. The main addition here, as promised, is smtp_appender. As the name imply, this allows for sending log messages to emails.

For this, I've used smtp_client written by Michael Bradford (http://erlang.org/user.html#smtp_client-1.1) with some modifications that allows it to work with Erlang/OTP R12B. I don't think the additions will allow it to work with Erlang/OPT R11B or earlier. If so, you can download and use the original smtp_client from erlang.org instead of the included module in Log4erl distribution.

smtp_client doesn't support SSL authentication, so smtp_appender might not work with gmail or some other email servers that require SSL, but for everything else, this should be enough. Please send me your feedback on this.

Note however that you should use smtp_appender with fatal or warn messages and shouldn't be used with more verbose log levels as the current implementation connects every time to the email server when sending email. I think this should be clear but just wanted everyone to know.

Also, there are 2 other additions, the most important is the feedback when error. For example, if you tried to add an appender with name already registered, you should get an error. Please check README.txt and CHANGELOG.txt for more info.

Log4erl is evolving rapidly in recent days. Next I'm going to add syslog appender and, possibly, html appender. Also, I'll try to add the much needed configuration file for log4erl.

Anyways, we still need to do a lot of work before reaching the 1.0 milestone on July.

Good luck,

Ahmed

Saturday, February 28, 2009

Log4erl in github.com

Hi,

I have added log4erl to github.com repository. I've planned to adding this for sometime becuase it seems many people prefer git to svn and wanted to offer both choices. I will not stop updating google code's svn but I'll maintain both github.com and google code's. You can find the github page below

http://github.com/ahmednawras/log4erl

Have fun.

Ahmed

Tuesday, February 10, 2009

Fixed a small bug in log4erl-0.8.3

Hi,

I've just fixed a bug in the latest log4erl version which caused a crash and multiple restarts by the supervisor for file_appenders when rotated. I don't know how I missed this one but it's fixed now. If you are currently using version 0.8.3, you must have noticed this by now. You can download the latest one with the fix in google code's. The file is named log4erl-0.8.3_2.tar.gz. Thanks to Mark for bringing this up to my attention.

Best regards,

Ahmed

Saturday, February 7, 2009

Small step... log4erl 0.8.3

Hi,

A new version of log4erl (0.8.3) is out there. This release includes small additions and changes. This release has been staying in my disk for sometime now waiting for docs to be included in the release tar. I've just updated repository and added the tarball to the download section. An update to the manual is due soon.

The new additions include a console appender, few additions to the log_formatter and small fixes. Refer to README.txt file in the tarball for updated API document. The new additions to log_formatter includes 3 new specifiers (%i, %b, %B) which outputs milliseconds, short month's name (e.g. Feb), month's name (e.g. February).

Next release will include SMTP logger and perhaps a simple configuration file.

As usual, please send your comments and suggestions to my email (can be found in README.txt file). Next is to update the manual. Until then, enjoy.

Ahmed

Thursday, December 4, 2008

Log4erl 0.8 manual is out

Hi,

I've just added a new manual for log4erl 0.8. A functions I didn't talk about previously is log4erl:get_appenders/0,1, which basically returns what appenders are currently added to a logger.

Following up to my previous post, I forgot to mention one missing feature for log4erl 1.0, which is file configuration. Currently, you can only interact with log4erl using specified API (check this in the manual). However, I'd like to have the ability to configure log4erl using a file (xml?, erlang term?, properties files?) so that users can just say log4erl:file("log.conf"). The format of the configuration file is not determined yet but it's not difficult to imagine having more than 1.

Time is scarce and I'm busy but I'll try to do all of this by July '09 as expected. This is all for now. Have a good day!

Wednesday, December 3, 2008

Log4erl 0.8.2 is out

Hi All,

It's been a long time and as usual been busy with other projects. However, finally another release is out. I've just released version 0.8.2 of log4erl. It's a small step but, hopefully, in the right direction. This code has been in my computer for some time now.

The most important addition here is log4erl:change_format/2,3. This is similar to PatternLayout in Log4j. A list of specifiers can be found in README.txt file. Using log4erl:change_format/2,3, you'll be able to change the layout of the outputed message. Also, there's log4erl:change_log_level/1,2 plus some bug fixes.

I think this is a good time to talk about where this project is going and where I do intend to take it. I've got some questions regarding performance, email logging, Syslog...etc. All of these features are within the scope of log4erl. However, it's too early to say when they will be added. The main concern for me now is to freeze the API and make log_manager stable. Once this is done, adding new formatters will be simpler. Performance metrics and optimization should be done around the time log_manager is stable.

Having said that, I think console_formatter is necessary and I'd like to add SMTP formatter soon. By log4erl 1.0, I intend to have at least 3 formatters: file_formatter, console_formatter, smtp_formatter. Also, a performance benchmark should be published by that time. The expected release of version 1.0 is around July 2009 but please don't bet on it. There are a lot of variables here and I don't want to give promises. This is just an educated guess.

I had some questions about distributed logging. Such a feature is not intended to be part of the short-term plan for log4erl. I started log4erl to be used in my own projects, which are mainly run in single-server machines and decided to share it with the rest of the community. I believe distributed logging needs a more careful design and testing methods, although I believe implementing distributed logging is simpler in erlang than other languages. For now, the only distributed mechanism log4erl can do is through rpc:call/4.

Anyways, back to work. The next step is the long-awaited manual for log4erl 0.8. Until then, have a good time.

Sunday, August 3, 2008

API changes in 0.8

I haven't got a lot of time to explain the API changes in 0.8. I'll get around to this task when possible. For now, I'll quickly introduce some changes.

In 0.7, Log4erl didn't have the concept of appender. For version 0.7, logger and appender where the same things. So, when you add a new logger with specific properties, you basically create a logger, add an appender with the properties. That's why version 0.7 had log4erl:add_file_logger/1,2 functions.

The biggest change in 0.8, is the separation of both. So now, you can create a logger and add as many appenders to it. Currently, there are only file_appender and dummy_appender. Dummy_appender is basically dumps all messages sent to it. It can be useful during development. An example for using the new API, the following code adds 2 appenders to the default logger, one is a file_appender and the other is dummy_appender.

> log4erl:add_appender({file_appeneder, appender1}, {"../logs", "logger1", {size, 100000}, 4, "elog", warn}).
> log4erl:add_appender({dummy_appender, dummy}, "").

As you can see above, developer is required to supply a tuple of name of the module and a name for the appender as the first agrument to add_appender/2. The 2nd item in the tuple is an identifier used by Log4erl. You can get all appenders for a logger using log4erl:get_appenders/0,1

Users can also use add_file_appender/2,3 and add_dummy_appender/2,3 as convenient functios for add_appender.

Another useful function in the API is change_log_level/1,2, by which users can change log level without having to restart Log4erl.

I hope this is useful for all of Log4erl 0.8 users. As I said, I'll get around to modifiying the manual in google code to reflect these changes. Until then, have a nice day :)