Problem logging

1
0
-1

Hi everyone.

I wanted to use the BPM studio log to print some info while developing, but I'm not able to do so. I have a really simple example (a task with a connector) with the following code:

import java.util.logging.Logger;
Logger logger= Logger.getLogger("org.bonitasoft");
logger.info("Log: infor");
logger.warning("Log: warning");
logger.severe("Log: severe");

However, the studio log does not contain these messages. The log looks like this:

!ENTRY org.bonitasoft.studio.engine 1 0 2017-10-02 11:11:07.363
!MESSAGE Attempt to login as helen.kelly

!ENTRY org.bonitasoft.studio.engine 1 0 2017-10-02 11:11:07.392
!MESSAGE Login successful.

!ENTRY org.bonitasoft.studio.engine 1 0 2017-10-02 11:11:07.710
!MESSAGE Building bar for process Pool3 (1.0 )...

!ENTRY org.bonitasoft.studio.engine 1 0 2017-10-02 11:11:07.710
!MESSAGE Expression of input separator is null for connector null

!ENTRY org.bonitasoft.studio.engine 1 0 2017-10-02 11:11:07.710
!MESSAGE Expression of input outputType is null for connector null

!ENTRY org.bonitasoft.studio.engine 1 0 2017-10-02 11:11:07.845
!MESSAGE Build complete for process Pool3 (1.0 ).

!ENTRY org.bonitasoft.studio.engine 1 0 2017-10-02 11:11:07.881
!MESSAGE Attempt to login as helen.kelly

!ENTRY org.bonitasoft.studio.engine 1 0 2017-10-02 11:11:07.888
!MESSAGE Login successful.

!ENTRY org.bonitasoft.studio.engine 1 0 2017-10-02 11:11:08.048
!MESSAGE Attempt to login as helen.kelly

!ENTRY org.bonitasoft.studio.engine 1 0 2017-10-02 11:11:08.056
!MESSAGE Login successful.

I already modified the config.ini and set eclipse.log.level=ALL.
What can be the problem here?

Thanks in advance.
Best

Comments

Submitted by Dibyajit.Roy on Tue, 10/03/2017 - 14:02

Hello
Check the Engine logs.
I think , By default all logs are stored in engine logs.

regards

Submitted by vitiellom on Wed, 10/04/2017 - 10:30

Hi and thank for your answer.
Indeed the debug messages were written in the engine log!
However that was only half of my issue. Turns out that if I edit and save the engine log (e.g. I delete old logs messages), Bonita does not any longer write on it. Restarting the Bonita BPM seems to fix the issue...but then if I edit and save the log I'm back to the starting problem. Strange behavior but ok.
However, thanks for the help!

Best

1 answer

1
0
-1
This one is the BEST answer!

As already answered by Dibyajit, you need to look at Engine log file when you produce the log in a code executed by Bonita Engine (such as all Groovy script, connectors... that are part of your process definition).

Studio log file is helpful to get more detail about issues that are related to usage of Studio it self. For example it can help to understand why the build of a process failed.

On Linux you can clear the log file with the following command: echo > catalina.out

But as a general recommendation I would suggest not to edit the log file and rather configure log size limit and rotation.

Comments

Submitted by Dibyajit.Roy on Wed, 10/04/2017 - 11:18

Hi Antoine
Thanks for the Update.
Is it possible to configure any other log apart from Engine Log and Studio Log.
Actually , If we can maintain a separate log to catch errors specific to our process.
Then we can track process and its errors separately.
As already used in other Software's, we can read and write to log files specific from a location.

thanks .

Submitted by antoine.mottier on Wed, 10/04/2017 - 11:27

Yes you can configure a different logger for your process / application.

First step is to use your own logger name such as com.companyname.projectname instead of org.bonitasoft.

Second step is to edit the logging.properties file in Tomcat configuration and add a new file handler, add a new line to associate com.companyname.projectname with your new handler and define the log level for your logger (you can reuse and adapt the configuration create for bonita file handler and associated logger.

Submitted by vitiellom on Wed, 10/04/2017 - 16:33

Hi,
thank you both for the answers. I like the idea of having a separate log file for debugging but as I'm not sure how to configure and create a new handler I think I will be fine with clearing the log myself via terminal for the moment :)

Thanks again
Best

Submitted by antoine.mottier on Wed, 10/04/2017 - 18:21

Here is an example of Logger configuration:

# Configuration for my custom Bonita application (log produce with logger named "com.company.myapp")

# Configuration of the storage of log messages (Handler)
6myapp.org.apache.juli.FileHandler.level = ALL
6myapp.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
6myapp.org.apache.juli.FileHandler.prefix = myapp.

# Association between Logger ("com.company.myapp") and the Handler
com.company.myapp.handlers = 6myapp.org.apache.juli.FileHandler

# Configuration of log level for the Logger
com.company.myapp.level = FINE 
Submitted by vitiellom on Thu, 10/05/2017 - 10:34

Works like a charm. Thanks!

Notifications