Tuesday, November 11, 2008

Eclipse WST / WTP

When working with eclipse and WTP most of us encounter the problem of tomcat shared libs. One good way to solve this would be to use

WTP Server Config --> Server locations --> Use tomcat Installation


Monday, November 3, 2008

Logrotate and log4j

I discovered the power of linux logroate today. A simple config file and you get automatic rotation + retaintion policy for your application logs. Take a look...


Things get interesting when you want to use this one with log4j. log4j has DailyFileAppender


This is the one everybody ends up using, But the trouble here is you can never configure it correctly to work with logroatate. Nor should you try, It's like two programs are trying to do the same thing...

The closest thing to logroate in log4j is

you can configure it to a very high max size (say 1 GB) and set Maxbackupindex to zero ! . It is kind of an way of using it as a FileAppender with a max cap on size. After this it's logroate's job to take care of rotation and retaintion.

Typical log4j Appender
<appender name="MyAppender" class="org.apache.log4j.RollingFileAppender">
<param name="MaxFileSize" value="1GB" />
<param name="MaxBackupIndex" value="0" />
<param name="File" value="/path/to/log" />

Retain 4 weeks worth of log.

"/path/to/log" {
size 100M
rotate 4

Sunday, November 2, 2008

Problems with mod_mem_cache

mod_mem_cache does not seem to work as expected with virtual hosts. Looking at the code (2.2.7), it does not have a merge_server_config when that is a necessity for modules supporting virtual hosts. Documentation does not say it supports vhosts though.

External digest-auth

I was looking at the possibility of doing external auth from apache mod_digest. Looks like it is quite a possibility. I don't know if anyone has ever done this...

typedef struct {
authn_status (*check_password)(request_rec *r, const char *user,const char *password);
authn_status (*get_realm_hash)(request_rec *r, const char *user, const char *realm, char **rethash);
} authn_provider;

basically any module that registers itself in AUTHN_PROVIDER_GROUP needs to implement *check_password* and *get_realm_hash*, so it can get that information from any place it likes to .... One possibility is to get it from an external RESTful http service (using libcurl).