Logentries Docs

Find comprehensive guides and documentation to help you start and continue to work with Logentries.


Search results for "{{ search.query }}"

No results found for "{{search.query}}". 
View All Results

Logentries supports Logging from Android applications. The main features of this library include:

  • Send Logs via HTTP POST: Option of changing from Token TCP (data.logentries.com) to using HTTP POST sending to the endpoint http://webhook.logentries.com/noformat/logs/
  • Send Logs via SSL: The library can send logs via Token TCP over TLS/SSL over port 443 by default. Note that the library itself does not validate or manage TLS/SSL certificates.
  • Storing logs offline and sending when connected: While sending logs, if the device loses connection, logs are stored locally until a connection is reestablished then they sent to Logentries. 10mb queue limit
  • Each log sent contains the device TraceID which is a unique 35 character ID associated with the device as well as a unique DeviceID.

Create An Account

If you have not done so already, you will need to create a Logentries account. Just click the ‘Sign up’ button at the top of this page and register your email address.

Create Log

Log in to Logentries and create a new log by clicking the Add New Log button. Now click Manual Configuration button from the list of options. Give your log a name of your choice, select Token TCP and finally click the Register new log button. A token will be displayed in green. Please record it as we will use it later to configure the library.

Configure the library

Next go to Jitpack and select the latest version of the Android library. Follow the instructions provided to install the library.

Add the permission "android.permission.INTERNET" to the project manifest file.


In the desired Activity class, import com.logentries.logger.AndroidLogger;

The following simple example shows the library used in a basic Android application Activity - where the logger is set to use TCP with a Token UUID "159axea4-xxxx-xxxx-xxxx-xxxxxxxxxxxx" - this is a dummy token for demonstration purposes only.
Remember to replace the Token with one taken from the Log created from the earlier setup.

When a new instances of the Activity is created, a simple log event message is sent. For further information on the Android Activity and its life cycle, refer to the official Android developer documentation.

    import android.app.Activity;
    import android.os.Bundle;
    import com.logentries.logger.AndroidLogger;
    import java.io.IOException;

    public class MyActivity extends Activity {
        private AndroidLogger logger = null;

         * Called when the activity is first created.
        public void onCreate(Bundle savedInstanceState) {
            try {
                logger = AndroidLogger.createInstance(getApplicationContext(), false, false, false, null, 0, "159axea4-xxxx-xxxx-xxxx-xxxxxxxxxxxx", true);
            } catch (IOException e) {
            logger.log("MyActivity has been created");

The number and type of arguments of the 'AndroidLogger.createInstance' are as follows:

(Context context, boolean useHttpPost, boolean useSsl, boolean isUsingDataHub, String dataHubAddr, int dataHubPort, String token, boolean logHostName)

Note that exceptions are generated where mutually exclusive settings collide - these are:
"useHttpPost" and "useSsl" cannot be both true - HTTP is not available with TLS/SSL
"useHttpPost" and "isUsingDataHub" cannot be both true - use one or the other only

  • 'context' : for example, if in an Activity class, use getApplicationContext(), or if in an Application class, use getBaseContext().

  • 'useHttpPost' : if set true, use HTTP (note cannot be used with TLS/SSL or the Datahub)

  • 'useSsl' : if set true, the data sent using the default TCP Token, will be done over an SSL Socket
    Note that the library itself does not validate or manage TLS/SSL certificates - it will use the default TrustManager
    and KeyManager used by the application or host.

  • 'isUsingDataHub' : if set true, library will forward log events to a Datahub (requires Datahub IP Address and Port)

  • 'dataHubAddr' : is a String of the IP Address of your DataHub machine.

  • 'dataHubPort' : is an int of the port number of your incoming connection on your DataHub machine.
    The default is port 10000, but this can be changed to any port by altering the /etc/leproxy/leproxyLocal.config file

    on your DataHub machine and restarting the leproxy daemon using "sudo service leproxy restart".
  • 'token' : the Token UUID, this is unique to the log to which the log events are sent
    This can be copied from the log in the the Logentries Account

  • 'logHostName' : if set true will return host name in log event

Watch your Logs

After some log events are generated and sent to Logentries successfully, you can log into your account select the logs that you would like to investigate. Click the Live Tail button to see your incoming logs in real time.