Discussion: Individual logfiles for scheduled jobs

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Discussion: Individual logfiles for scheduled jobs

Philipp Hoppen
Hello

In our OFBIz projects we often work with scheduled jobs. Since it is
often useful to view the logging output of a job, we created a mechanism
for writing this output to a file and making it accessable over the
OFBIz JobList. We extended the service-declaration with a parameter
called "own-logfile" with specifies the name of the logfile to use. When
a job is executed, a timestamp is appended to this filename to guarantee
unique filenames. We modified the class GenericServiceJob to register an
appender for the current thread if this property is set and unregister
it when the job is done. The name of the logfile is stored in JobSandbox
and is used to allow downloading the file from the JobList and for
deleting the logfile when the purgeOldJobs service runs. We would like
to contribute our code if others find this idea useful. If you have any
suggestions to improve our idea or to integrate it better with OFBIz,
please let us know.


Best regards

--
Philipp Hoppen,
nowhow solutions AG, Laupenstrasse 1, CH-3008 Bern
Phone +41 (0)31 380 00 71 http://www.nowhow.ch

Reply | Threaded
Open this post in threaded view
|

Re: Discussion: Individual logfiles for scheduled jobs

Malin Nicolas
It's good idea.

Just litle suggestions :) for more usefull, I think to have un link
associate to the job on sheduled jobs interface to read log from html
interface as runtime/logs/ofbiz.html permit a quick maintenance.

Nicolas

Philipp Hoppen a écrit :

> Hello
>
> In our OFBIz projects we often work with scheduled jobs. Since it is
> often useful to view the logging output of a job, we created a
> mechanism for writing this output to a file and making it accessable
> over the OFBIz JobList. We extended the service-declaration with a
> parameter called "own-logfile" with specifies the name of the logfile
> to use. When a job is executed, a timestamp is appended to this
> filename to guarantee unique filenames. We modified the class
> GenericServiceJob to register an appender for the current thread if
> this property is set and unregister it when the job is done. The name
> of the logfile is stored in JobSandbox and is used to allow
> downloading the file from the JobList and for deleting the logfile
> when the purgeOldJobs service runs. We would like to contribute our
> code if others find this idea useful. If you have any suggestions to
> improve our idea or to integrate it better with OFBIz, please let us
> know.
>
>
> Best regards
>


--
Nicolas MALIN
Consultant
Tél : 06.17.66.40.06
Site projet : http://www.neogia.org/
-------
Société LibrenBerry
Tél : 02.48.02.56.12
Site : http://www.librenberry.net/

Reply | Threaded
Open this post in threaded view
|

Re: Discussion: Individual logfiles for scheduled jobs

Philipp Hoppen
Hello

I followed your suggestion and switched from file download to a
html-view of the log adding a parameter to the existing LogView request.
I also modified the code how to specify if an individual logfile is
desired from setting an attribute in the service specification (this
approach is not so flexible at runtime) to a checkbox on the job
scheduling screen. This means i had to add another schedule() method to
the LocalDispatcher interface.

Any other comments on this? Can I send in my patch using Jira?


Malin Nicolas schrieb:

> It's good idea.
>
> Just litle suggestions :) for more usefull, I think to have un link
> associate to the job on sheduled jobs interface to read log from html
> interface as runtime/logs/ofbiz.html permit a quick maintenance.
>
> Nicolas
>
> Philipp Hoppen a écrit :
>> Hello
>>
>> In our OFBIz projects we often work with scheduled jobs. Since it is
>> often useful to view the logging output of a job, we created a
>> mechanism for writing this output to a file and making it accessable
>> over the OFBIz JobList. We extended the service-declaration with a
>> parameter called "own-logfile" with specifies the name of the logfile
>> to use. When a job is executed, a timestamp is appended to this
>> filename to guarantee unique filenames. We modified the class
>> GenericServiceJob to register an appender for the current thread if
>> this property is set and unregister it when the job is done. The name
>> of the logfile is stored in JobSandbox and is used to allow
>> downloading the file from the JobList and for deleting the logfile
>> when the purgeOldJobs service runs. We would like to contribute our
>> code if others find this idea useful. If you have any suggestions to
>> improve our idea or to integrate it better with OFBIz, please let us
>> know.
>>
>>
>> Best regards
>>
>
>


--
Philipp Hoppen,
nowhow solutions AG, Laupenstrasse 1, CH-3008 Bern
Phone +41 (0)31 380 00 71 http://www.nowhow.ch

Reply | Threaded
Open this post in threaded view
|

Re: Discussion: Individual logfiles for scheduled jobs

Jacques Le Roux
Administrator
At this stage I would say, "yes feel free to submit a patch" Then maybe you will get more comments or the patch will be applied
quickly.

Jacques

From: "Philipp Hoppen" <[hidden email]>

> Hello
>
> I followed your suggestion and switched from file download to a html-view of the log adding a parameter to the existing LogView
> request. I also modified the code how to specify if an individual logfile is desired from setting an attribute in the service
> specification (this approach is not so flexible at runtime) to a checkbox on the job scheduling screen. This means i had to add
> another schedule() method to the LocalDispatcher interface.
>
> Any other comments on this? Can I send in my patch using Jira?
>
>
> Malin Nicolas schrieb:
>> It's good idea.
>>
>> Just litle suggestions :) for more usefull, I think to have un link associate to the job on sheduled jobs interface to read log
>> from html interface as runtime/logs/ofbiz.html permit a quick maintenance.
>>
>> Nicolas
>>
>> Philipp Hoppen a écrit :
>>> Hello
>>>
>>> In our OFBIz projects we often work with scheduled jobs. Since it is often useful to view the logging output of a job, we
>>> created a mechanism for writing this output to a file and making it accessable over the OFBIz JobList. We extended the
>>> service-declaration with a parameter called "own-logfile" with specifies the name of the logfile to use. When a job is executed,
>>> a timestamp is appended to this filename to guarantee unique filenames. We modified the class GenericServiceJob to register an
>>> appender for the current thread if this property is set and unregister it when the job is done. The name of the logfile is
>>> stored in JobSandbox and is used to allow downloading the file from the JobList and for deleting the logfile when the
>>> purgeOldJobs service runs. We would like to contribute our code if others find this idea useful. If you have any suggestions to
>>> improve our idea or to integrate it better with OFBIz, please let us know.
>>>
>>>
>>> Best regards
>>>
>>
>>
>
>
> --
> Philipp Hoppen,
> nowhow solutions AG, Laupenstrasse 1, CH-3008 Bern
> Phone +41 (0)31 380 00 71 http://www.nowhow.ch
>