Logs

## About Opush logs
The Opush log file is located at _/var/log/opush/opush.log_

### Format
Opush logs are printed following a specific format, this is an example of a log line.

05:26:36.669 [INFO] {IMAP.COMMAND} [t10079/cFolderSync/r942/userlogin@obm.lng.org]:true

**Details :**

* **05:26:36.669** is the time when the action was done
* **[INFO]** is the log level
* **{IMAP.COMMAND}** is the name of the logger which has printed the line
* **t10079** is the thread id
* **cFolderSync** is the ActiveSync command name preceed by c. Here the command was "FolderSync"
* **r942** is the request id
* **userlogin@obm.lng.org** is the user
* **true** is the logged data

### Logger module
Opush, like all java component of obm, use a logger API to generate information useful to developers to investigate bugs.
This section documents how to configure the right log level for your needs as an end user.

The configuration file to change which logs are printed is located at : _/etc/opush/logback.xml_. Modification are taken into account every minute.
You can check that everything is applied correctly by looking to logs in _/var/log/jetty/*stderrout.log_ .

A sample file looks like :




You can use the following logger modules :

* **AUTHENTICATION** for authentication information
* **REQUEST.FULL** for requests and responses from and to the server, with sensitive data
* **REQUEST.TRIMMED** for requests and responses from and to the server, without sensitive data
* **IMAP.COMMAND** for imap conversations
* **OBM-SYNC** for data exchanged between opush and obm-sync web services
* **CONFIGURATION** for configuration details, printed at application startup

## Bug Report and error logs by email
Unfortunately, logs are often too verbose or doesn't contains the right information.
To work around this design problem about logs, we chose a logger that provides a SmtpLogger : it allows us to keep a buffer of the last logs, in a very verbose mode, and send them by email as soon as a log with the level "ERROR" is triggered.

We try to be very careful about log levels in order to use this SmtpLogger.

If you want to contribute some bug reports for obm-opush, the first thing to do is to configure this feature by editing _/etc/opush/logback.xml_ file and putting something like (please be careful to define smtpHost, to and from in this piece of xml) :



localhost
youremailaddress
yourfromaddress
OPUSH: %logger{20} - %m

%d{HH:mm:ss.SSS} [%-5level] {%logger{32}} [t%X{threadId}/c%X{command}/r%X{requestId}/%X{user}]:%msg%n

50










Then, every time you receive an email with an error, you can check on our [Bugtracker](http://ci-obm.linagora.com/jira) if this is a known bug or report it if it seems new.

Please attach the email on this bug, with as much information as possible about what you where doing when the error happened.

Be careful to remove sensitive information from the error email, as it can contain some private data


Adidas Questar Boost