I am using restless API for my webservice implementation. I see that following lines are being printed on console for every call to my webservice:
Aug 5, 2016 12:30:09 PM org.restlet.engine.log.LogFilter afterHandle
INFO: 2016-08-05 12:30:09 172.23.4.200 - 172.23.7.44 8080 GET /abcservice/xyz - 200 86 0 21 http://localhost
There are so many calls to my webservice and as a result my logs (tomcat catalina.out) are going crazy. I want to disable this logging.
I have configured the log4j settings in log4j.xml How can I disable this logging.
You can set the root logger level to OFF (instead of WARN, DEBUG, INFO, etc)
e.g. log4j.rootLogger = OFF
But, I will recommended you to keep the level to WARN. You will not get the INFO logs but it will let you know about Warnings, Error and Fatal in your applications.
Priority of the logging levels:
**
ALL < DEBUG < INFO < WARN < ERROR < FATAL < OFF
**
Related
I stop my server update when it was creating DDL statments and restart the server. Now my server is stuck at below line. I did ant clean all and again tried to start the server but still same issue.
How to resolve this?
log4j:WARN No such property [maxFileSize] in org.apache.log4j.DailyRollingFileAppender.
Feb 07, 2020 2:28:29 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://www.springframework.org/security/tags is already defined
log4j:WARN No appenders could be found for logger (de.hybris.platform.servicelayer.web.XSSFilter).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Feb 07, 2020 2:28:29 PM org.apache.catalina.startup.TldConfig execute
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Feb 07, 2020 2:28:30 PM org.apache.catalina.startup.TldConfig execute
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Run the following SQL request to check if the system is locked.
select process,locked from systeminit ;
if locked = 1, update it to 0.
I am running an application as a systemd service. Application logs its output to stdout following systemd logging rules - prepending each log message with <x> where x is priority (log level).
<6> this is info
<7> this is debug
<4> this is warning
What I want is to store only priority <= 6 to journal because I run on flashdisk. I don't wan't to store debug messages and also messages/"trash" that is not marked with <>.
Seems not to be a problem - MaxLevelStore=info.
BUT - the problem is that that "trash" written to stdout is marked as priority=6 (info) by default and is also stored inside journal db. What I want is to mark it as debug (7) by default, so from following output:
<6> this is info
<7> this is debug
this is some trash
<4> this is warning
... will only ...
<6> this is info
<4> this is warning
... be stored to journal.
Can't find in all docs I have if/how is this possible. Anybody?
Thank you
You want to useSyslogLevel=debug in the [Service] section of your service. This will cause all messages that aren't prefixed by the priority to default to having a level of debug (7).
Documentation:
https://www.freedesktop.org/software/systemd/man/systemd.exec.html#SyslogLevel=
How do I silence the debug logging in http componenets?
09:23:22.145 [main] DEBUG o.a.h.c.protocol.RequestAddCookies - CookieSpec selected: default
09:23:22.145 [main] DEBUG o.a.h.c.protocol.RequestAuthCache - Auth cache not set in the context
09:23:22.145 [main] DEBUG o.a.h.i.c.PoolingHttpClientConnectionManager - Connection request: [route: {}->http://example.org:80][total kept alive: 1; route allocated: 1 of 100; total allocated: 1 of 200]
09:23:22.145 [main] DEBUG o.a.h.i.c.PoolingHttpClientConnectionManager - Connection leased: [id: 0][route: {}->http://diagnostics-uat.corp.apple.com:80][total kept alive: 0; route allocated: 1 of 100; total allocated: 1 of 200]
09:23:22.145 [main] DEBUG o.a.h.impl.execchain.MainClientExec - Executing request POST /evt/detect HTTP/1.1
09:23:22.145 [main] DEBUG o.a.h.impl.execchain.MainClientExec - Target auth state: UNCHALLENGED
09:23:22.145 [main] DEBUG o.a.h.impl.execchain.MainClientExec - Proxy auth state: UNCHALLENGED
09:23:22.145 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> POST /evt/detect HTTP/1.1
09:23:22.145 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> Content-Length: 92
I have tried a code based solution:
static {
System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog");
System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.http", "warn");
}
public static void main(String[] args) throws Exception {
And this log4j.properties
log4j.rootLogger=INFO, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%c] %m%n
log4j.logger.org.apache.http=WARN
log4j.logger.org.apache.http.wire=WARN
But neither have worked. Help is appreciated, thanks!
You settings are correct possible causes may be another log4j config file is in the classpath and overriding your config. So I will recommended this.
- Ensure you log4j.properties file is in classpath . Use below command to see open files by a process (assuming unix)
lsof -p java-process-pid | grep log4j
Search for log4j.properties in your runtime folders and get rid of all duplicate files (if possible) - otherwise change them all.
Search for log4j.xml and do the same.
Sometimes I have seen third party jars that ship with a log4j.xml or log4j.properties so in worst case check for all jars using below command
jar -tvf a.jar | grep log4j
Programmatically, it can be set silent with:
(Apache HttpComponents 4.3.5)
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
...
Logger.getLogger("org.apache.http") .setLevel(Level.WARN);
Logger.getLogger("org.apache.http.wire") .setLevel(Level.WARN);
Logger.getLogger("org.apache.http.headers").setLevel(Level.WARN);
I love Winston and use it in all my projects. Now I have a need to log to a syslog server in one of my applications. I thought, "No problem. Winston has a transport for that. Easy!"
But I have found an issue. The log levels between npm (console) and syslog are not compatible. Example:
In my application I have configured my logs (mostly) like this
// To use syslog stuff. Commented out for the initial example
//winston.setLevels(winston.config.syslog.levels);
// Console logging should have timestamps which are off by default
winston.remove(winston.transports.Console);
winston.add(winston.transports.Console, {timestamp: true});
// Add my syslog transport
winston.add(
winston.transports.Syslog,
{
level: 'info',
host: config.app.syslog.host,
facility: config.app.syslog.facility,
json: false
}
));
At this point, everything as far as my console logging goes is great. I can
winston.info('Info');
winston.error('Error');
and I get 2 console logs.
But when I uncomment the winston.setLevels(winston.config.syslog.levels); part so I can properly use syslog levels, I no longer get any output to the when I winston.error('Error').
"Hmmmm", I thought. "Maybe having my log level set at 'info' is the problem because info and error levels are inverted in their order between npm and syslog mappings and maybe Winston only considers increasing log-levels."
value | npm level | syslog level
---------+-------------+----------------
0 | silly | emerg
1 | debug | alert
2 | verbose | crit
3 | INFO | ERROR
4 | warn | warning
5 | ERROR | notice
6 | | INFO
7 | | debug
Armed with this theory, I set level: error and tried again. And again, same result.
Has anyone gotten this to work so that I can just
var logger = require('winston');
logger.info('Info');
logger.error('Error');
in any modules that I please after my initial setup? Each log call should write to my console AND to my syslog.
Transports must also be created with the custom levels (syslog levels). The console transport is created before you add the custom levels. You may have a better chance with this code :
logger = new winston.Logger({
levels: winston.config.syslog.levels,
colors: winston.config.syslog.colors
});
logger.add(winston.transports.Console);
I have a small Rexster/Titan cluster using Cassandra. A Rexster extension is used to query the graph. I did some benchmarking and did start and stop Rexster/Titan many times. But now I run into a strange issue: Rexster refuses to start but does not display any error message.
I tried to figure out what is causing this and reduced the cluster to a single node 192.168.0.4.
If I remove my extension Rexster manages to start up.
# console output
Forking Cassandra...
Running `nodetool statusthrift`..... OK
(returned exit status 0 and printed string "running").
Forking Titan + Rexster...
Connecting to Titan + Rexster (127.0.0.1:8184)...... OK
(connected to 127.0.0.1:8184).
Run rexster-console.sh to connect.
but when I place my extension uber JAR in the ext folder Rexster refuses to start.
# console output
Forking Cassandra...
Running `nodetool statusthrift`..... OK
(returned exit status 0 and printed string "running").
Forking Titan + Rexster...
Connecting to Titan + Rexster (127.0.0.1:8184)............................
timeout exceeded (60 seconds): could not connect to 127.0.0.1:8184
See /var/lib/titan/bin/../log/rexstitan.log for Rexster log output.
If I now check rexstitan.log, as suggested by the console output, I can not find any error message.
# rexstitan.log
0 [main] INFO com.tinkerpop.rexster.Application - .:Welcome to Rexster:.
73 [main] INFO com.tinkerpop.rexster.server.RexsterProperties -
Using [/var/lib/titan/rexhome/../conf/rexster-cassandra-cluster.xml]
as configuration source.
78 [main] INFO com.tinkerpop.rexster.Application - Rexster is watching
[/var/lib/titan/rexhome/../conf/rexster-cassandra-cluster.xml] for change.
244 [main] INFO com.netflix.astyanax.connectionpool.impl.ConnectionPoolMBeanManager -
Registering mbean: com.netflix.MonitoredResources:type=ASTYANAX,
name=ClusterTitanConnectionPool,ServiceType=connectionpool
252 [main] INFO com.netflix.astyanax.connectionpool.impl.CountingConnectionPoolMonitor -
AddHost: 192.168.0.4
537 [main] INFO com.netflix.astyanax.connectionpool.impl.ConnectionPoolMBeanManager -
Registering mbean: com.netflix.MonitoredResources:type=ASTYANAX,
name=KeyspaceTitanConnectionPool,ServiceType=connectionpool
538 [main] INFO com.netflix.astyanax.connectionpool.impl.CountingConnectionPoolMonitor -
AddHost: 192.168.0.4
1951 [main] INFO com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration -
Set cluster.partition=false from store features
1971 [main] INFO com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration -
Set default timestamp provider MICRO
2019 [main] INFO com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration -
Generated unique-instance-id=7f0000012902-node1
2045 [main] INFO com.netflix.astyanax.connectionpool.impl.ConnectionPoolMBeanManager -
Registering mbean: com.netflix.MonitoredResources:type=ASTYANAX,
name=ClusterTitanConnectionPool,ServiceType=connectionpool
2046 [main] INFO com.netflix.astyanax.connectionpool.impl.CountingConnectionPoolMonitor -
AddHost: 192.168.0.4
2053 [main] INFO com.netflix.astyanax.connectionpool.impl.ConnectionPoolMBeanManager -
Registering mbean: com.netflix.MonitoredResources:type=ASTYANAX,
name=KeyspaceTitanConnectionPool,ServiceType=connectionpool
2054 [main] INFO com.netflix.astyanax.connectionpool.impl.CountingConnectionPoolMonitor -
AddHost: 192.168.0.4
2228 [main] INFO com.thinkaurelius.titan.diskstorage.Backend -
Initiated backend operations thread pool of size 4
6619 [main] INFO com.thinkaurelius.titan.diskstorage.log.kcvs.KCVSLog -
Loaded unidentified ReadMarker start time Timepoint[1423479705116000 μs]
into com.thinkaurelius.titan.diskstorage.log.kcvs.KCVSLog$MessagePuller#212f3ff1
6625 [main] INFO com.tinkerpop.rexster.RexsterApplicationGraph -
Graph [graph] - configured with allowable namespace [*:*]
The only entry that looks strange to me is the one concerning the log:
6619 [main] INFO com.thinkaurelius.titan.diskstorage.log.kcvs.KCVSLog -
Loaded unidentified ReadMarker start time Timepoint[1423479705116000 μs]
into com.thinkaurelius.titan.diskstorage.log.kcvs.KCVSLog$MessagePuller#212f3ff1
My exception uses the logger for debugging. You can see the instantiation an usage on github: https://github.com/sebschlicht/titan-graphity-kribble/blob/master/src/main/java/de/uniko/sebschlicht/titan/extensions/GraphityExtension.java#L22
Though Rexster failed to start there is a process with the PID displayed in the console but curl fails to connect to Rexster:
$ curl 192.168.0.4:8182
curl: (7) Failed to connect to 192.168.0.4 port 8182: Connection refused
Why doesn't Rexster throw an exception? How can I debug this situation?
edit:
I removed any log messages in my code. I removed all exceptions that may be thrown during startup. Still Rexster refuses to start with my extension and the only hint in the log files is the unidentified read marker. I have to clue what prevents Rexster from starting.
The log message is nothing to worry about.
After rebuilding the application in another project step-by-step Rexster is now able to start with the extension. During this rebuild I noticed two situations, that can cause the behaviour described:
Missing dependency
If your project depends on a second project you might use Maven to inject it as a dependency. However, if you use
mvn clean package
to build the extension's JAR file it does not contain this dependency by default. You need to use a Maven plugin (e.g. maven-shade-plugin) to create a shaded JAR that contains all the dependencies your extension needs. Set the dependency scope to provided for all Titan/Rexster/Blueprints related dependencies. Use the shaded uber-JAR to deploy the extension to Rexster.
However, this was not new to me and should not have caused the problem in my case. There might be more situations that cause this problem or maybe there was a problem with Maven that messed up the shaded JAR. Feel free to browse the commit on github to catch this voodoo.
Missing extension
Another cause of this behaviour is a missing extension.
If you specify an extension in the com.tinkerpop.rexster.extension.RexsterExtension resource file, that is not present on startup, Rexster does neither log nor throw an exception, but refuses to start.