Hey Jens,

A log4r logger that connects up to a Java logger would be very useful 
for keeping all the logs together.

Setting the servlet to load on startup can be done in the web.xml:

  <servlet>
    <servlet-name>test</servlet-name>
    <servlet-class>nz.ac.auckland.ec.TestServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>


Cheers,
Robert

Jens Kraemer wrote:
> Hi,
>
> I just tried out the PeriodicalTaskServlet with a simple task running
> every 60 seconds. All it does is logging the current time via
> RAILS_DEFAULT_LOGGER each time it is run.
>
> The task is correctly executed every 60 seconds but only every other log
> statement from the task appears in the Rails log file. I know it's
> correctly executed every minute since logging with $servlet_context.log
> results in a log statement every minute as expected.
>
> This happened on Linux with JDK1.5/Tomcat 5.5.
>
> My theory now is that the job is executed by a different JRuby runtime
> each time it runs (I have a maximum of 2 runtimes configured), and
> Rails' simple logging mechanism can't handle that, resulting in lost log
> statements.
>
> So my question now is - how do you handle logging in your JRuby/Rails
> applications? 
>
> Imho a more global logging facility would be needed to correctly log
> input from multiple runtimes, just like the servlet_context logger.
> Something mimicking the behaviour of Rails' Logger class would be needed
> to make it a drop-in replacement. Shouldn't be too hard to do I guess,
> but I'd rather ask here before re-inventing the wheel ;-)
>
> Btw, is there any way to get the servlet initialized by the container
> other than having to hit the path where it's mounted with the browser? I
> had to do so - only after that the servlet's init method was called and
> it started executing the job.
>
>
> many thanks,
> Jens
>
>
>   
_______________________________________________
Jruby-extras-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/jruby-extras-devel

Reply via email to