Archive

Splunk6 DB Connect 1.1.1 No handlers could be found for logger "spp.java"

Engager

Hi,

I am having similar issue to that described here

http://answers.splunk.com/answers/105605/the-java-bridge-server-is-not-running-dbx-110

I am running Splunk6 and DB Connect 1.1.1 on a Linux VM. When I installed it, it ran well yesterday, but after starting Splunk today I get Java Bridge not running, and the following errors that have been previously been reported.

message from "python /home/frank/splunk6/splunk/etc/apps/dbx/bin/jbridge_server.py" No handlers could be found for logger "spp.java"

Any suggestions on how to resolve this ?

The 1.1.1 version of the code already hase the exception handling changes suggested.
bin/spp/java/init.py

try:
    logger = logging.getLogger("spp.java")
except:
    logger = logging.getLogger()

Thanks / Frank

1 Solution

Splunk Employee
Splunk Employee

let's add a root logger to "spp", so all "spp.*" will work.

in bin/spp/java/_init_.py

add the following lines:


import os, logging

logging.basicConfig(level=logging.DEBUG,
     filename=os.path.join(os.environ["SPLUNK_HOME"], "var", "log", "splunk", "jbridge.log"), format="%(asctime)s %(levelname)s %(message)s", filemode="a")

before the line:

logger=logging.getLogger("spp.java")

Note: the better place for the spp root logger is in:

bin/spp/_init_.py

that covers all loggers in bin/spp and below packages.

View solution in original post

Splunk Employee
Splunk Employee

This may workout better for some people:

1.) Do not modify the $SPLUNK_HOME/etc/apps/dbx/bin/spp/java/__init__.py file

2.) Instead, add the following entries in $SPLUNK_HOME/etc/apps/dbx/bin/spp/__init__.py (the file is empty by default):


import os, logging
logging.basicConfig(level=logging.DEBUG,
filename=os.path.join(os.environ["SPLUNK_HOME"], "var", "log", "splunk", "jbridge.log"),
format="%(asctime)s %(levelname)s %(message)s", filemode="a")

0 Karma

New Member

Temporary Work-around:

try:
#logger = logging.getLogger("spp.java")
logger = logging.getLogger("spp.dbx.javabridge")
except:
logger = logging.getLogger()

Logs appear in jbridge.log after the above change.

0 Karma

Splunk Employee
Splunk Employee

I just gave an example, to avoid the same name. but we need a root logger handler, that can point to a file, like dbx.log. I will take your word to make it as dbx.log for root handler.

0 Karma

New Member

So dbx_py.log is a new log along with dbx.log and jbridge.log?

What I did is only logging java bridge errors to the jbridge.log and not all debug messages. Not that it wouldn't trap additional messages unrelated to jbridge. May just be a pleasant side effect for (..me..) the time being. Hopefully, the author will address logging for this and other needs "INFO,WARN,DEBUG,etc..."

I did add your line #commented for future use if I need debug output.

0 Karma

Splunk Employee
Splunk Employee

The except occurs when you do:

logger.debug(...)

not

logging.getLogger()

reason is the handler that is not defined. so The best is to do:

logging.basicConfig(level=logging.DEBUG,
filename=os.path.join(os.environ['SPLUNKHOME'], 'var', 'log', 'splunk', 'dbxpy.log'), format='%(asctime)s %(levelname)s %(message)s', filemode='a')

logger = logging.getLogger("spp.java")

0 Karma

Splunk Employee
Splunk Employee

let's add a root logger to "spp", so all "spp.*" will work.

in bin/spp/java/_init_.py

add the following lines:


import os, logging

logging.basicConfig(level=logging.DEBUG,
     filename=os.path.join(os.environ["SPLUNK_HOME"], "var", "log", "splunk", "jbridge.log"), format="%(asctime)s %(levelname)s %(message)s", filemode="a")

before the line:

logger=logging.getLogger("spp.java")

Note: the better place for the spp root logger is in:

bin/spp/_init_.py

that covers all loggers in bin/spp and below packages.

View solution in original post