{"id":18854807,"url":"https://github.com/zahidmed/log4j-database","last_synced_at":"2025-04-14T10:43:29.262Z","repository":{"id":115855631,"uuid":"47579718","full_name":"zahidMed/log4j-database","owner":"zahidMed","description":"This library provides log4j appenders that write log events to SQL, noSQL and Cloud stores","archived":false,"fork":false,"pushed_at":"2015-12-16T15:53:45.000Z","size":28,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-30T13:36:46.994Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zahidMed.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-12-07T21:17:20.000Z","updated_at":"2019-12-19T17:44:06.000Z","dependencies_parsed_at":"2023-03-23T07:43:06.679Z","dependency_job_id":null,"html_url":"https://github.com/zahidMed/log4j-database","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zahidMed%2Flog4j-database","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zahidMed%2Flog4j-database/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zahidMed%2Flog4j-database/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zahidMed%2Flog4j-database/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zahidMed","download_url":"https://codeload.github.com/zahidMed/log4j-database/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248867606,"owners_count":21174748,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T03:51:52.526Z","updated_at":"2025-04-14T10:43:29.218Z","avatar_url":"https://github.com/zahidMed.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"#log4j-database\n##What is it?\n\nThis is an open source library that extends log4j appender for storing log events in multiple databases and data stores such as SQL based ones (Mysql, Postresql ...), noSQL based databases (OrientDB, Cassandra, HBase, MongoDB...) and Cloud datastore (Google, Amazon ....).\n\nThis library allows the use of the same table/collection/class for storing events from many applications by adding the application identifier field. It uses also an event queue in order to execute a bulk insert and increase the event log performance.\n\nThe current version 1.1.0 handle OrientDB and Cassandra, the other ones are on the way :)\n\n##OrientDBAppender\nThis appender was developed to support OrientDB version 2.0.10 or higher.\n\n###OrientDBAppender dependencies\n\nWhen using OrientDBAppender, add the following dependencies:\n\n\t\t\u003cdependency\u003e\n\t\t\t\u003cgroupId\u003elog4j\u003c/groupId\u003e\n\t\t\t\u003cartifactId\u003elog4j\u003c/artifactId\u003e\n\t\t\t\u003cversion\u003e1.2.17\u003c/version\u003e\n\t\t\u003c/dependency\u003e\n\t\t\u003cdependency\u003e\n\t\t\t\u003cgroupId\u003ecom.orientechnologies\u003c/groupId\u003e\n\t\t\t\u003cartifactId\u003eorientdb-client\u003c/artifactId\u003e\n\t\t\t\u003cversion\u003e2.0.10\u003c/version\u003e\n\t\t\u003c/dependency\u003e\n\t\t\u003cdependency\u003e\n\t\t\t\u003cgroupId\u003ecom.orientechnologies\u003c/groupId\u003e\n\t\t\t\u003cartifactId\u003eorientdb-core\u003c/artifactId\u003e\n\t\t\t\u003cversion\u003e2.0.10\u003c/version\u003e\n\t\t\u003c/dependency\u003e\n\t\t\u003cdependency\u003e\n\t\t\t\u003cgroupId\u003ecom.orientechnologies\u003c/groupId\u003e\n\t\t\t\u003cartifactId\u003eorientdb-enterprise\u003c/artifactId\u003e\n\t\t\t\u003cversion\u003e2.0.10\u003c/version\u003e\n\t\t\u003c/dependency\u003e\n\t\t\u003cdependency\u003e\n\t\t\t\u003cgroupId\u003ecom.googlecode.json-simple\u003c/groupId\u003e\n\t\t\t\u003cartifactId\u003ejson-simple\u003c/artifactId\u003e\n\t\t\t\u003cversion\u003e1.1.1\u003c/version\u003e\n\t\t\u003c/dependency\u003e\n\n###OrientDBAppender configuration\n\nthe appender **org.log4database.orientdb.OrientDBAppender** can be configured using the following parameters in log4j configuration file:\n\nProperty | Description\n------------ | -------------\nhostname | the database host name\nport | database port. Default value 2424\ndatabaseName | the database name, it should be a document database. Default value \"log\"\ntable | the class name used in to store events. Default value \"log\"\nuserName | the database user\npassword | the database password\napplicationId | the application identifier when using the same class for storing events from many applications\nqueueLength | the queue capacity for keeping events before performing a bulk insert. Default value 10\n\n###Log database configuration\n\nBefore using OrientDB based logging, a class should be created in a Document database to maintain all the log information. Following is the script for creating the log class.\n\n    create class log\n    CREATE PROPERTY log.appId integer // when using the property applicationId\n    CREATE PROPERTY log.timestamp Datetime\n    CREATE PROPERTY log.loggerName String\n    CREATE PROPERTY log.level String\n    CREATE PROPERTY log.thread String\n    CREATE PROPERTY log.message String\n    CREATE PROPERTY log.fileName String\n    CREATE PROPERTY log.method String\n    CREATE PROPERTY log.lineNumber integer\n    CREATE PROPERTY log.class String\n    CREATE PROPERTY log.properties Embeddedmap\n\n###Sample configuration file\n\nFollowing is a sample configuration file log4j.properties for OrientDBAppender which will be used to log messages to a log class.\n    \n    # Set the root logger to\n    log4j.rootLogger=all, OrientDB\n    \n    log4j.appender.OrientDB=org.log4database.orientdb.OrientDBAppender\n    log4j.appender.OrientDB.hostname=localhost\n    log4j.appender.OrientDB.port=2424\n    log4j.appender.OrientDB.table=log\n    log4j.appender.OrientDB.databaseName=log\n    log4j.appender.OrientDB.userName=user\n    log4j.appender.OrientDB.password=user\n    log4j.appender.OrientDB.applicationId=1\n    log4j.appender.OrientDB.queueLength=30\n\n\n###Sample code\n\nThe following Java class is a very simple example that initializes and then uses the Log4J-database library for Java applications.\n\n\n\timport org.apache.log4j.Logger;\n\t\n\tpublic class log4jExample{\n\t\n\t\tpublic static Logger logger=Logger.getLogger(\"OrientDB\");\n\t\n\t\t\tpublic static void main(String[] arg){\n\t\t\tlogger.debug(\"This is a debug message \");\n\t\t\tlogger.info(\"This is an info message\");\n\t\t}\n\t}\n\t\n\t\n##CassandraAppender\nThis appender was developed to support Cassandra version 2.1.0 or higher.\n\n###CassandraAppender dependencies\n\nWhen using CassandraAppender, add the following dependencies:\n\n\t\t\u003cdependency\u003e\n\t\t\t\u003cgroupId\u003elog4j\u003c/groupId\u003e\n\t\t\t\u003cartifactId\u003elog4j\u003c/artifactId\u003e\n\t\t\t\u003cversion\u003e1.2.17\u003c/version\u003e\n\t\t\u003c/dependency\u003e\n\t\t\u003cdependency\u003e\n\t\t\t\u003cgroupId\u003ecom.datastax.cassandra\u003c/groupId\u003e\n\t\t\t\u003cartifactId\u003ecassandra-driver-core\u003c/artifactId\u003e\n\t\t\t\u003cversion\u003e2.1.0\u003c/version\u003e\n\t\t\u003c/dependency\u003e\n\t\t\n###CassandraAppender configuration\n\nthe appender **org.log4database.cassandra.CassandraAppender** can be configured using the following parameters in log4j configuration file:\n\nProperty | Description\n------------ | -------------\nhostname | the database host name\nport | database port. Default value 9042\ndatabaseName | the keyspace name. Default value \"log\"\ntable | the table name used in to store events. Default value \"log\"\nuserName | the database user\npassword | the database password\napplicationId | the application identifier when using the same class for storing events from many applications\nqueueLength | the queue capacity for keeping events before performing a bulk insert. Default value 10\n\n###Log database configuration\n\nBefore using OrientDB based logging, a class should be created in a database to maintain all the log information. Following is the script for creating the log table.\n\n    CREATE TABLE log.log (\n    id uuid ,\n    appId int,\n    timestamp timestamp,\n    level text,\n    thread text,\n    loggerName text,\n    fileName text,\n    method text,\n    lineNumber int,\n    class text,\n    message text,\n    properties map\u003ctext,text\u003e,\n    PRIMARY KEY (uuid, appId,timestamp,level, ...)//add all the fields you will use in where statement when parsing logs\n    );\n\n###Sample configuration file\n\nFollowing is a sample configuration file log4j.properties for CassandraAppender which will be used to log messages to a log class.\n    \n    # Set the root logger to\n    log4j.rootLogger=all, Cassandra\n\n    # Cassandra appender classname\n    log4j.appender.Cassandra=org.log4database.cassandra.CassandraAppender\n    log4j.appender.Cassandra.hostname=localhost\n    log4j.appender.Cassandra.port=9042\n    log4j.appender.Cassandra.table=log\n    log4j.appender.Cassandra.databaseName=log\n    log4j.appender.Cassandra.userName=cassandra\n    log4j.appender.Cassandra.password=cassandra\n    log4j.appender.Cassandra.applicationId=1\n    log4j.appender.Cassandra.queueLength=10\n\n\n###Sample code\n\nThe following Java class is a very simple example that initializes and then uses the Log4J-database library for Java applications.\n\n\n\timport org.apache.log4j.Logger;\n\t\n\tpublic class log4jExample{\n\t\n\t\tpublic static Logger logger=Logger.getLogger(\"Cassandra\");\n\t\n\t\t\tpublic static void main(String[] arg){\n\t\t\tlogger.debug(\"This is a debug message \");\n\t\t\tlogger.info(\"This is an info message\");\n\t\t}\n\t}","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzahidmed%2Flog4j-database","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzahidmed%2Flog4j-database","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzahidmed%2Flog4j-database/lists"}