Get messages.log style logging out of embedded neo4j - java

How can I maximize the log information an embedded neo4j database will give me, so that I can see what's going on?
Recent technical discussion on the google group called for an excerpt of messages.log, but I don't have that log file since I'm running embedded. I have consulted the server configuration docs (http://docs.neo4j.org/chunked/stable/server-configuration.html#_server_logging_configuration) but they don't tell me the actual names of the loggers to use.
I have tried this:
java.util.logging.Logger.getLogger("org.neo4j").setLevel(Level.ALL)
But by default, and also with this line of code, I see no log messages from neo4j at all.
I'm trying to get some of the server message logs to debug why certain read-only transactions are failing and rollback is failing; first I have to figure out how to get neo4j to tell me what's going on in this embedded database.

Actually you have messages.log it is in your graph.db directory.
And there are loads of diagnostic, config, tuning, memory and other information in that file. So very valuable.

Related

Is it possible to create custom fields in a Kibana dashboard?

I am using a Java micro-service architecture in my application and generating separate log files for each micro-service.
I am using ELK stack approach to visualize the logs in Kibana, but the problem is whatever the fields that I'm getting from Elastic Search that are related to server logs fields. some example fields are #timestamp,#version,#path,#version.keyword,#host.
i want to customize this fields by adding some fields like customerId,txn-Id,mobile no so that we can analyze the data easily.
I'm using org.apache.logging.log4j2 to write the logs. Can I set above fields (customerId,txn-Id,mobile) to log files? And then Elastic will store these fields with the above default fields and then these custom fields should available in a Kibana dashboard. Is this possible?
It's definitely possible to do that. I've not done it with the log4j2 stack (I have with slf4j/logback), but the basic approach is:
set those fields in the Mapped Diagnostic Context (I'm fairly sure log4j2 supports that)
use a log appender which logs to logstash-structured JSON
configure filebeat to ship the JSON logs
if filebeat is shipping to logstash, you'll need to configure logstash to pass those preformatted JSON logs directly to elasticsearch
It is definitely possible. I am doing that now with my applications. However, the output looks a bit different from yours. The basic guide for doing this can be found at Logging in the Cloud on the Log4j2 web site.
The "normal" log view looks very similar to what you would see when logging to a file.
However, if you select a message you can see the individual fieds.
The Log4j2 configuration uses a TCP Socket appender that is configured to write to a cluster of Logstash servers that use a single DNS entry and to use the Gelf layout.
You can also use MapMessages to capture individual data elements and log them. While this currently works it is slightly cumbersome so I have recently committed improvements that will be available in Log4j 2.15.0.
It is important to note that the Logging in the Cloud page briefly mentions storing your logging configuration in Spring Cloud Config. If you want to have a common base configuration while allowing apps to do some customization this works very, very well. However, The Gelf, Json Template Layout and TCP Appender are all independent from that and can be used without Spring Boot.

How can I turn off logging in HSQL DB with URL parameter?

I am using java-ee application running on wicket.
The problem is, that the connection to the HyperSQL database with JDBC creates a huge log file *.log. Example of my URL:
jdbc:hsqldb:file:C:\database\text;hsqldb.sqllog=0;hsqldb.applog=0
I need to turn off the logging with some jdbc url parameter. I have tried these:
hsqldb.sqllog=0;hsqldb.applog=0;
That is not working, so I have tried this combination:
hsqldb.log_data=false;hsqldb.reconfig_logging=false
But with these parameters, when I stop the app, the data disappears.
The text.log file is the record of transactions performed on your database. If you disable it with hsqldb.log_data=false the transactions are not persisted to disk. The name is derived from the file name on your database URL.
The hsqldb.sqllog and hsqldb.applog settings are for diagnostics and default to 0.
The hsqldb.reconfig_logging=false is also for diagnostics and works together with hsqldb.applog setting. These settings are discussed in the Guide: http://hsqldb.org/doc/2.0/guide/management-chapt.html#mtc_monitoring_operation
So if you want your data to survive when your app shuts down, you should not disable the default log. See http://hsqldb.org/doc/2.0/guide/management-chapt.html#mtc_cache_persistence on how to reduce the size of the text.log file.

Selenium Webdriver: what is root logger and manual logger in log4j

I have recently come across this line of code and i read that root logger is for system generated code
log4j.rootLogger=debug,file
where as
log4j.logger.devpinoyLogger=DEBUG, dest1
this for application logs, this will help log information generated by manual code.
Can you please explain the difference between application logs and system generated logs
I hope that you know how logs are configured for log4j. If not then open this link and follow the How log4j is configured?
Now coming back to your question that what is the difference between APPLICATION LOGS and SYSTEM GENERATED LOGS.
Application Logs:
The application log is a tool that collects messages, exceptions & errors from an application. This information is organized and displayed in a log
System Logs:
The system logs for every important action like system errors, warnings, user locks, & process message etc. in the system log
Difference:
Application logging records the progress of the execution of an application, whereas the system log record system events.
I hope this answers your question.

Unable to locate c3p0 logging messages

Up until recently, we created a new database connection for every query. Each query is setup using connection.prepareStatement(query) and we were able to log these queries to our logger (java.util.logging) with preparedStatement.toString(). This was using the postgresql JDBC driver.
Now we've switched to using c3p0 to manage connection pools and unfortunately preparedStatement.toString() no longer returns the prepared query statement.
I have read that c3p0 logging can be directed to the standard logging facility but unfortunately I have been unable to find where these messages are going. Where can I find these messages? Glassfish 3's console in NetBeans states that debugging is enabled.
INFO: Initializing c3p0-0.9.1.2 [built 21-May-2007 15:04:56; debug? true; trace: 10]
I'm not sure, if c3p0's logging is what you are really looking for?
I would recommend using log4jdbc, which can log any JDBC queries (with parameters), and even provide you with a stack trace pointing to your JDBC/Hibernate/... statement, even if you're using a connection pool (use the option -Dlog4jdbc.debug.stack.prefix=com.mycompany.myapp). It can also display timing information, and a lot more.
The logging seems to be on like the log says (debug?true), but if you read the box on the link you had on your post you will find the setup options that should be checked for finding the right file.
If you end up logging to the so called last resort option, it should log to System.Err and this may cause the problem: this post tells that System.Err is not by default always visible in any log file!
So keep trying the other options on the previously mentioned box or use the fix on the answer section of the post I linked :)

hsqldb messing up with my server´s logs

I have a server I made in Java that needs to use a database, I chose HSQLDB.
So I have a lot of entries in my server like:
Logger.getLogger(getClass().getName()). severe or info ("Some important information");
When I run my server it goes to System.out which I think its the default configuration of java.util.logging?, so far its ok for me, and later I will make it go to a file ...
But, the problem is, when I start hsqldb it messes up with the default configuration and I can´t read my log entries on System.out anymore..
I already tried to change hsqldb.log_data=false, but it still messes up the default configuration.
Can someone help me??
I dont want to log hsqldb events, just my server ones.
Thanks
This issue was reported and fixed in the latest version 2.2.0 released today.
Basically, you set a system property hsqldb.reconfig_logging to the
string value false.
A system property is normally set with the -D option in the Java startup command for your application:
java -Dhsqldb.reconfig_logging=false ....
See below for details of the change:
http://sourceforge.net/tracker/?func=detail&aid=3195462&group_id=23316&atid=378131
In addition, when you use a fremework logger for your application, you should configure it directly to choose which levels of log to accept and which ones to ignore.
The hsqldb.applog setting does not affect framework logging and only controls the file log.
The hsqldb.log_data=false is for turning off internal data change logging and should not be used for normal databases. Its usage for bulk imports is explained in the Guide.
Try setting hsqldb.applog to 0, that shuts off application logging to the *.app.log file.
Start your server with a property pointing to the location of a dedicated properties file:
-Djava.util.logging.config.file=/location/of/your/hsqldblog.properties"
Which contains the following line to change Java logging for Hsqldb.
# Change hsqldb logging level
org.hsqldb.persist = WARNING
Side note, you can choose from the following levels:
SEVERE WARNING INFO CONFIG FINE FINER FINEST

Categories

Resources