-
Notifications
You must be signed in to change notification settings - Fork 25.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
move logger.trace() outside of try statement #6100
Comments
I think that maybe we should validate that trace is actually there when the log4j logger is configured, and fail the node from starting..., this is probably bad on many other places... |
This is not real node. It is transport client embedded into our application. TransportClient connects to the real ES nodes. The only place where you can do this kind of checking is constructor of TransportClient by throwing an exception ( which I don't like): Client client = new TransportClient(settings); My point is - It is our application fault to use old log4j library, but your diagnostic exception should be clearer. After I replace log4j to newer version everything was fine... |
Related slf4j.org. log4j added trace on August 29, 2005 in Any environment that is producing this issue really has a very outdated version of log4j on the classpath (e.g., What may be useful is to do what @kimchy is getting at, but in a grander way on startup of the client. In essence, create a short integration test that kicks off at startup that tests known potential issues that are deemed worthwhile, and rethrows them as an Personally, if we wanted to fail/test for this behavior, then I would actually just add a logger.trace to the top of the function that did something like |
We also bumped on this and it isn't cool. Required a remote debugging in a comlpex environment... Can't you just do one of the following:
i can understand that this is partly our fault because as @pickypg said, we had an old version of the log4j jar in the classpath. One more thing would be to throw an IllegalStateException when you do the logger detection in the ESLogger factory if there is no trace level. |
We should add a check for the ability to log at trace level in the transport client. |
We could do this as a very lightweight 'LoggingCheckerModule' started by the transport client which checks it can log at each level |
While using TransportClient in application with older log4j version 1.2.8 it is possible to get very misleading NoNodeAvailableException (see at the very bottom of this message):
The reason is that log4j doesn't have method trace() and call to logger.trace() is placed inside try/catch(Throwable) below. It results in exception being thrown during execution of logger.trace() which later lead to NoNodeAvailable exception down the road.
Thanks,
Igor.
protected ImmutableList validateNewNodes(Set nodes) {
for (Iterator it = nodes.iterator(); it.hasNext(); ) {
DiscoveryNode node = it.next();
if (!transportService.nodeConnected(node)) {
try {
logger.trace("connecting to node [{}]", node);
transportService.connectToNode(node);
} catch (Throwable e) {
it.remove();
logger.debug("failed to connect to discovered node [" + node + "]", e);
}
May 8 11:15:28 9.21.119.107 [dataNode.dataNode] [Ariel Writer#events] org.elasticsearch.client.transport.NoNodeAvailableException: No node available
May 8 11:15:28 9.21.119.107 [dataNode.dataNode] [Ariel Writer#events] at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:219)
The text was updated successfully, but these errors were encountered: