OrientDB utilizes the Java Logging structure packaged with Java Virtual Machine. OrientDB's default log design is overseen by OLogFormatter class.
The accompanying assertion is the essential grammar of logging order.
<date> <level> <message> [<requester>]
Following are the insights concerning the alternatives in the above punctuation.
- <date> − It is the log date in the accompanying configuration: yyyy-MM-dd HH:mm:ss:SSS.
- <level> − It is the logging level as 5 roasts yield.
- <message> − It is the content of log, it very well may be of any size.
- [<class>] − It is the Java class that is logged (discretionary).
Upheld levels are those contained in the JRE class java.util.logging.Level. They are −
- Serious (most noteworthy worth)
- Caution
- Data
- CONFIG
- FINE
- Better
- Best (most reduced worth)
Of course, two lumberjacks are introduced −
Reassure, as the yield of the shell/order brief that begins the application/worker. Can be changed by setting the variable 'log.console.level'.
Record, as the yield to the log documents. Can be changed by setting the 'log.file.level'.
Configure Logging
The logging techniques and arrangements can be designed utilizing a document following the Java.
punctuation − Java Logging design.
Example
Duplicate the accompanying substance from orientdb-worker log.properties document and put it in the $ORIENTDB_HOME/config record.
# Specify the handlers to create in the root logger
# (all loggers are children of the root logger)
# The following creates two handlers
handlers = java.util.logging.ConsoleHandler, java.util.logging.FileHandler
# Set the default logging level for the root logger
.level = ALL
# Set the default logging level for new ConsoleHandler instances
java.util.logging.ConsoleHandler.level = INFO
# Set the default formatter for new ConsoleHandler instances
java.util.logging.ConsoleHandler.formatter =
com.orientechnologies.common.log.OLogFormatter
# Set the default logging level for new FileHandler instances
java.util.logging.FileHandler.level = INFO
# Naming style for the output file
java.util.logging.FileHandler.pattern =../log/orient-server.log
# Set the default formatter for new FileHandler instances
java.util.logging.FileHandler.formatter = com.orientechnologies.common.log.OLogFormatter
# Limiting size of output file in bytes:
java.util.logging.FileHandler.limit = 10000000
# Number of output files to cycle through, by appending an
# integer to the base file name:
java.util.logging.FileHandler.count = 10
To tell the JVM where the properties document is put, you need to set the "java.util.logging.config.file" framework property to it. For instance, utilize the accompanying order −
$ java -Djava.util.logging.config.file=mylog.properties ...
Set the logging level
To change the logging level without adjusting the logging design, just set the "log.console.level" and "log.file.level" framework factors to the mentioned levels.
Logging at Startup
Following are the methods to set logging at startup level in an unexpected way.
In the Server Configuration
Open the document orientdb-worker config.xml and add or update these lines toward the finish of the record inside the <properties> area −
<entry value = "fine" name = "log.console.level" />
<entry value = "fine" name = "log.file.level" />
In Server.sh (or .bat) Script
Set the framework property "log.console.level" and "log.file.level" to the levels you need utilizing the - D boundary of java.
$ java -Dlog.console.level = FINE ...
Logging at Run-time
Following are the methods to set logging at startup level in an unexpected way.
By Using Java Code
The framework variable can be set at startup utilizing the System.setProperty() API. The accompanying code piece is the linguistic structure to set logging level utilizing Java code.
public void main(String[] args){
System.setProperty("log.console.level", "FINE");
...
}
On Remote Server
Execute a HTTP POST against the URL:/worker/log.<type>/<level>, where −
- <type> can be "reassure" or "record"
- <level> is one of the upheld levels
Example
The accompanying model uses cURL to execute a HTTP POST order against OrientDB Server. Worker's "root" client and secret key were utilized, supplant with your own secret key.
Empower the best following level to comfort −
curl -u root:root -X POST http://localhost:2480/server/log.console/FINEST
Empower the best following level to record −
curl -u root:root -X POST http://localhost:2480/server/log.file/FINEST