I wrote a ROS node using rosjava.
When it starts up, there are a few logging outputs like:
Loading node class: MyApp.RosWrapper
Jun 18, 2015 3:12:39 PM org.ros.internal.node.client.Registrar <init>
INFO: MasterXmlRpcEndpoint URI: http://localhost:11311
Jun 18, 2015 3:12:39 PM org.ros.internal.node.client.Registrar onPublisherAdded
INFO: Registering publisher: Publisher<PublisherDefinition<PublisherIdentifier<NodeIdentifier</mynode, http://127.0.0.1:39009/>, TopicIdentifier</rosout>>, Topic<TopicIdentifier</rosout>, TopicDescription<rosgraph_msgs/Log, acffd30cd6b6de30f120938c17c593fb>>>>
I've found out that rosjava uses the org.apache.commons.logging.Log approach (see https://github.com/rosjava/rosjava_core/blob/indigo/rosjava/src/main/java/org/ros/internal/node/client/Registrar.java#L54)
To configure this, you should normally put a file called commons-logging.properties in your Classpath. I tried to add the folder containing this file to the classpath, but nothing changed.
UPDATE:
I found out that by default rosjava uses the Jdk14Logger class.
How can I decrease the log-level to e.g. WARN? Where do I have to put the corresponding config files?
Disclaimer: As stated in the comment, this does not work for rosjava and therefore does not answer the question. I do not delete the post, however, to keep records that this has already been tried.
Permanent setting
To permanently modify the log-level, create a file and add something like the following:
# Set the default ros output to warning and higher
log4j.logger.ros=WARN
# Override my package to output everything
log4j.logger.ros.my_package_name=DEBUG
For ROS to use this file, you have to define the environment ROSCONSOLE_CONFIG_FILE and set it to the path of your file. This can be done by adding the following line to ~/.bashrc:
export ROSCONSOLE_CONFIG_FILE=/path/to/config_file
See also the ROS wiki about rosconsole configuration.
Temporary setting
If you only want to temporarily change the log-level for a currently running node, you can use the tool rqt_logger_level. This will start a GUI where you can change the log-level for each running node. The settings are not stored, however, so it will be lost after restarting the node.
To manage the log levels for any ROSJava project, create a file like this one:
log-config.properties
# 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
# log level for the "com.example" package
org.ros.logging.level=ALL
# Set the default logging level
java.util.logging.ConsoleHandler.level=ALL
java.util.logging.FileHandler.level=ALL
# Set the default formatter
java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter
# Specify the location and name of the log file
java.util.logging.FileHandler.pattern=/home/robot/test.log
and later, load the configuration in the execution:
java -Djava.util.logging.config.file=/home/robot/log-config.properties -jar rosjava-helloworld-0.1.0-SNAPSHOT-all.jar
Juan Antonio
Related
To adress security vulnerability CVE-2017-3241 (Java RMI Registry.bind() Unvalidated Deserialization) which affects JRE version prior to 1.8.0_121. In addition to using JRE 1.8.0_121 ,we added below lines of code in java.security file.
jdk.serialFilter=*
sun.rmi.registry.registryFilter=*
sun.rmi.transport.dgcFilter=\
java.rmi.server.ObjID;\
java.rmi.server.UID;\
java.rmi.dgc.VMID;\
java.rmi.dgc.Lease;\ maxdepth=2147483647;maxarray=2147483647;maxrefs=2147483647;maxbytes=2147483647
Once we add these lines then we are getting below lines whenever do any RMI call.
Feb 13, 2017 1:00:53 AM sun.misc.ObjectInputFilter$Config lambda$static$0
INFO: Creating serialization filter from *
We want to suppress these info, can somebody suggest any solution for this.
I use -Djdk.serialFilter=maxbytes=10000;!org.* as JVM arguments, don`t see any log info.
I have deployed the railo war file in a resin appserver and after deployment the jvm log shows
railo-server-root:/var/resin/webapps/railo-4.2.1.008/WEB-INF/lib/railo-server
===================================================================
SERVER CONTEXT
-------------------------------------------------------------------
- config:/var/resin/webapps/railo-4.2.1.008/WEB-INF/lib/railo-server/context
- loader-version:4.3
===================================================================
===================================================================
WEB CONTEXT (3ccbecdfdd85a2c229a64e875ca4821a)
-------------------------------------------------------------------
- config:/var/resin/webapps/railo-4.2.1.008/WEB-INF/railo
- webroot:/var/resin/webapps/railo-4.2.1.008/
- hash:3ccbecdfdd85a2c229a64e875ca4821a
- label:3ccbecdfdd85a2c229a64e875ca4821a
===================================================================
I can access a test index.cfm page kept at /var/resin/webapps/railo-4.2.1.008/index.cfm by calling
http://domain.com:8080/railo/index.cfm
But when I try to access http://domain.com:8080/railo/railo-context/admin/server.cfm or http://domain.com:8080/railo/railo-context/admin/web.cfm . It is loading a page with no css etc .
I also see the following error in the log
Wed Nov 19 02:15:51 EST 2014-311 class railo.runtime.instrumentation.Agent.getInstrumentation() is not returning a Instrumentation
static resource /railo-context/res/css/admin42.css.cfm was not found # /var/resin/webapps/railo-4.2.1.008/-context/res/css/admin42.css
static resource /railo-context/res/css/admin42.css.cfm was not found # /var/resin/webapps/railo-4.2.1.008/-context/res/css/admin42.css
static resource /railo-context/res/css/admin42.css.cfm was not found # /var/resin/webapps/railo-4.2.1.008/-context/res/css/admin42.css
What am I doing wrong
In your URL domain.com:8080/railo/railo-context/... is the first railo the context path? Basically, did you deploy a Railo war but not in the / context?
If so, you might need to modify the /railo-context/ virtual mapping in your railo-server.xml file to map to "/railo/railo-context/"
Also, check any rewrite rules set up.
Railo (not sure which version, but one of the 4.x ones) moved the admin resources (i.e. css, images) out of the same folder as the rest of the admin, meaning they're no longer in /railo-context/, and they now use paths like ../res/bar.css to load them.
Our fix was to add a proxy/rewrite for that other directory, too. For example:
ProxyPassMatch ^/my-secret-railo-location/admin/(.*)$ ajp://localhost:8009/railo-context/admin/$1
ProxyPassMatch ^/my-secret-railo-location/res/(.*)$ ajp://localhost:8009/railo-context/res/$1
The current SAX parser takes a lot of time (20 minutes) and heap memory(around 400mb) to deserialize the response coming from the soap server as per the logs. Our response XMLs are of average size 4 mb.
A part of the log when it runs the applicaiton out of heap is below
DEBUG (org.apache.axis.encoding.DeserializationContext) Pushing handler org.apache.axis.message.SOAPHandler#16d22f1
DEBUG (org.apache.axis.i18n.ProjectResourceBundle) org.apache.axis.i18n.resource::handleGetObject(newElem00)
DEBUG (org.apache.axis.message.MessageElement) New MessageElement (org.apache.axis.message.MessageElement#112c22) named {}name
DEBUG (org.apache.axis.encoding.DeserializationContext) Pushing element name
DEBUG (org.apache.axis.utils.NSStack) NSPush (32)
DEBUG (org.apache.axis.encoding.DeserializationContext) Exit: DeserializationContext::startElement()
DEBUG (org.apache.axis.encoding.DeserializationContext) Enter: DeserializationContext::endElement(, name)
DEBUG (org.apache.axis.i18n.ProjectResourceBundle) org.apache.axis.i18n.resource::handleGetObject(popHandler00)
DEBUG (org.apache.axis.encoding.DeserializationContext) Popping handler org.apache.axis.message.SOAPHandler#16d22f1
DEBUG (org.apache.axis.utils.NSStack) NSPop (32)
DEBUG (org.apache.axis.encoding.DeserializationContext) Popped element stack to org.apache.axis.message.MessageElement:property
DEBUG (org.apache.axis.encoding.DeserializationContext) Exit: DeserializationContext::endElement()
DEBUG (org.apache.axis.encoding.DeserializationContext) Enter: DeserializationContext::startElement(, value)
DEBUG (org.apache.axis.i18n.ProjectResourceBundle) org.apache.axis.i18n.resource::handleGetObject(pushHandler00)
DEBUG (org.apache.axis.encoding.DeserializationContext) Pushing handler org.apache.axis.message.SOAPHandler#16880ba
DEBUG (org.apache.axis.i18n.ProjectResourceBundle) org.apache.axis.i18n.resource::handleGetObject(newElem00)
DEBUG (org.apache.axis.message.MessageElement) New MessageElement (org.apache.axis.message.MessageElement#1db74af) named {}value
DEBUG (org.apache.axis.encoding.DeserializationContext) Pushing element value
DEBUG (org.apache.axis.utils.NSStack) NSPush (32)
DEBUG (org.apache.axis.encoding.DeserializationContext) Exit: DeserializationContext::startElement()
DEBUG (org.apache.axis.encoding.DeserializationContext) Enter: DeserializationContext::endElement(, value)
DEBUG (org.apache.axis.i18n.ProjectResourceBundle) org.apache.axis.i18n.resource::handleGetObject(popHandler00)
DEBUG (org.apache.axis.encoding.DeserializationContext) Popping handler org.apache.axis.message.SOAPHandler#16880ba
DEBUG (org.apache.axis.utils.NSStack) NSPop (32)
I cannot use Axis2 because of technical reasons.
I have tried using HTTP Commons client instead of HTTP client but the response time remains the same.
How can i link a different parser(example xerces 2.10.0 or xstream 1.3.1?) to Axis 1.4 framework in this context so that memory management and response time is favorable?.
From this link of installation
In the Axis directory, you will find a WEB-INF sub-directory. This directory contains some basic configuration information, but can also be used to contain the dependencies and web services you wish to deploy.
Axis needs to be able to find an XML parser. If your application server or Java runtime does not make one visible to web applications, you need to download and add it. Java 1.4 includes the Crimson parser, so you can omit this stage, though the Axis team prefer Xerces.
To add an XML parser, acquire the JAXP 1.1 XML compliant parser of your choice. We recommend Xerces jars from the xml-xerces distribution, though others mostly work. Unless your JRE or app server has its own specific requirements, you can add the parser's libraries to axis/WEB-INF/lib. The examples in this guide use Xerces. This guide adds xml-apis.jar and xercesImpl.jar to the AXISCLASSPATH so that Axis can find the parser (see below).
If you get ClassNotFound errors relating to Xerces or DOM then you do not have an XML parser installed, or your CLASSPATH (or AXISCLASSPATH) variables are not correctly configured.
In order for these examples to work, java must be able to find axis.jar, commons-discovery.jar, commons-logging.jar, jaxrpc.jar, saaj.jar, log4j-1.2.8.jar (or whatever is appropriate for your chosen logging implementation), and the XML parser jar file or files (e.g., xerces.jar). These examples do this by adding these files to AXISCLASSPATH and then specifying the AXISCLASSPATH when you run them. Also for these examples, we have copied the xml-apis.jar and xercesImpl.jar files into the AXIS_LIB directory. An alternative would be to add your XML parser's jar file directly to the AXISCLASSPATH variable or to add all these files to your CLASSPATH variable.
On Windows, this can be done via the following. For this document we assume that you have installed Axis in C:\axis. To store this information permanently in WinNT/2000/XP you will need to right click on "My Computer" and select "Properties". Click the "Advanced" tab and create the new environmental variables. It is often better to use WordPad to create the variable string and then paste it into the appropriate text field.
set AXIS_HOME=c:\axis
set AXIS_LIB=%AXIS_HOME%\lib
set AXISCLASSPATH=%AXIS_LIB%\axis.jar;%AXIS_LIB%\commons-discovery.jar;
%AXIS_LIB%\commons-logging.jar;%AXIS_LIB%\jaxrpc.jar;%AXIS_LIB%\saaj.jar;
%AXIS_LIB%\log4j-1.2.8.jar;%AXIS_LIB%\xml-apis.jar;%AXIS_LIB%\xercesImpl.jar;
%AXIS_LIB%\wsdl4j.jar
Unix users have to do something similar. Below we have installed AXIS into /usr/axis and are using the bash shell. See your shell's documentation for differences. To make variables permanent you will need to add them to your shell's startup (dot) files. Again, see your shell's documentation.
set AXIS_HOME=/usr/axis
set AXIS_LIB=$AXIS_HOME/lib
set AXISCLASSPATH=$AXIS_LIB/axis.jar:$AXIS_LIB/commons-discovery.jar:
$AXIS_LIB/commons-logging.jar:$AXIS_LIB/jaxrpc.jar:$AXIS_LIB/saaj.jar:
$AXIS_LIB/log4j-1.2.8.jar:$AXIS_LIB/xml-apis.jar:$AXIS_LIB/xercesImpl.jar:
$AXIS_LIB/wsdl4j.jar
export AXIS_HOME; export AXIS_LIB; export AXISCLASSPATH
To use Axis client code, you can select AXISCLASSPATH when invoking Java by entering
java -cp %AXISCLASSPATH% ...
I've got a problem with JacORB 3.2 as it seems that it doesn't read the orb.properties file, and especially the ORBInitRef.NameService property.
As stated in the documentation on chapter 3.1, JacORB automatically searches for the orb.properties file in three locations: the "java.home"/lib directory, the "user.home" directory and inside the classpath.
This is the evidence that I'm not totally drunk:
Java command:
System.out.println(System.getProperty("java.home"));
System.out.println(System.getProperty("user.home"));
Output:
/usr/lib/jvm/jdk1.7.0/jre
/home/emanuele
Bash command:
ls /usr/lib/jvm/jdk1.7.0/jre/lib | grep orb.properties ; ls /home/emanuele | grep orb.properties
Output:
jacorb.properties
orb.properties
jacorb.properties
orb.properties
These four .properties file are exactly the same. Please have a look at the URI of the file that contains the reference (IOR) of the NameService:
ORBInitRef.NameService=file:/tmp/CORBA/NS_Ref
The problem is that, when I try to launch the NameService without any parameter (ns) I got these error messages:
giu 05, 2013 9:56:51 PM org.jacorb.naming.NameServer main
SEVERE: unexpected exception
java.io.FileNotFoundException: c:/NS_Ref (No such file or directory)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:212)
at java.io.FileOutputStream.<init>(FileOutputStream.java:104)
at org.jacorb.naming.NameServer.main(NameServer.java:320)
java.lang.RuntimeException: c:/NS_Ref (No such file or directory)
at org.jacorb.naming.NameServer.main(NameServer.java:335)
Of course, if I explicitely pass the URI through console, everything goes fine
ns -Djacorb.naming.ior_filename=/tmp/CORBA/NS_Ref
The very strange thing is that, after the NameService is running, EVERY OTHER OBJECT can correctly and automatically resolve the initial reference of the NameService.
NamingContextExt nc = NamingContextExtHelper.narrow(orb.resolve_initial_references("NameService"));
The previous Java code returns a valid object. That does not make any sense for me.
And why does the NameService try to write its IOR inside a random file like C:\NS_Ref while I'm on Linux?
Any idea?
I thing you mixed up some different things in your question.
The location of the NS's IOR
The ability to read and use this IOR by other programs
First. Starting the NamingService is not affected by option ORBInitRef.NameService or any related commandline option. If you want the NamingService to drop it's IOR in a file, use
# The file where the name server drops its IOR
jacorb.naming.ior_filename=file:///tmp/CORBA/NS_Ref
as you already did. If this behaves different when using this as cmdline option, see 2.
Second. JacORB its config files are not OS specific - there is a mix of both Linux and Windows style. Don't rely on that.
Your call to ns will call the jaco script in JacORBs bin directory. Activate the verbosity stuff at the end of the file, then start ns again and see which jre and jacorb.home are really used. Look for configs. Remove ALL other configs you do not need.
Retry.
This
ns -Djacorb.naming.ior_filename=/tmp/CORBA/NS_Ref
looks fine, but shouldn't that
ORBInitRef.NameService=file:/tmp/CORBA/NS_Ref
read file:///tmp/CORBA/NS_Ref?
And this
c:/NS_Ref
is strange on Linux; that looks very windowzy to me; are you sure you've not mixed Win and Linux config files?
When tomcat is run from an IDE, it is usually not started using the startup script.
So logging configuration is not picked up.
Where do I need to put my configuration?
Tomcat initially uses java.util.logging to log. The format for that is not very easy to read.
To use a shorter logging output you must configure logging in a file. This file can either be the standard location defined by the startup script (%CATALINA_BASE%\conf\logging.properties).
If tomcat is started from the IDE then the file name must be defined on the command line via:
"-Djava.util.logging.config.file=...your-tomcat-installation\conf\logging.properties"
Sample:
handlers= java.util.logging.ConsoleHandler
.level= INFO
#SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST, ALL
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
java.util.logging.SimpleFormatter.format= %1$TH:%1$TM:%1$TS %4$-5s %2$s: %5$s%n
#results in:
#16:26:26 INFO org.apache.catalina.startup.Catalina load: Initialization processed in 201 ms
#for the format see the javadoc of java.util.logging.SimpleFormatter