schemacrawler / SchemaCrawler

Free database schema discovery and comprehension tool
http://www.schemacrawler.com/
Other
1.62k stars 200 forks source link

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". #179

Closed philCryoport closed 6 years ago

philCryoport commented 6 years ago

Environment

Specify the

Other relevant libraries: 03/16/2017 09:36 AM 41,203 slf4j-api-1.7.25-jar.jar (came with SchemaCrawler release) 01/14/2018 11:09 AM 993,917 graphviz-java-0.2.3-jar.jar 01/14/2018 11:09 AM 661,033 graphviz-java-0.2.3-source.jar (downloaded the GraphViz native Java libraries using the SchemaCrawler download tool.)

Issue

Please explain the issue briefly

schemacrawler.cmd -server=mysql -database=foo_db -host=barbaz.rds.amazonaws.com -port=3306 -user=theuser -infolevel=standard -command=schema -portablenames -title "Blah" -Gdpi=300 -outputformat=png -outputfile=graph.png -loglevel=ALL

schemacrawler.cmd file: @java -classpath "%~dp0/lib/*";"%~dp0/config";. -Xmx8G -Xms8G schemacrawler.Main %*

I've attached a sanitized screen capture -- at least for the 1000 lines ConEmu goes back. You'll see an IOException for program "dot" that it cannot find the file. However, a PNG file is created showing the tables as UML blocks...but it seems to be missing some of the foreign-key relationships. This IOException does not appear when the same command is run without the -loglevel=ALL command.

philCryoport commented 6 years ago

A note on "dot" not being found:

SEVERE: Cannot run program "dot": CreateProcess error=2, The system cannot find the file specified
java.io.IOException: Cannot run program "dot": CreateProcess error=2, The system cannot find the file specified
        at java.lang.ProcessBuilder.start(Unknown Source)
        at schemacrawler.utility.ProcessExecutor.call(ProcessExecutor.java:80)
        at schemacrawler.tools.integration.graph.GraphProcessExecutor.canGenerate(GraphProcessExecutor.java:134)
        at schemacrawler.tools.integration.graph.GraphExecutable.generateGraph(GraphExecutable.java:183)
        at schemacrawler.tools.integration.graph.GraphExecutable.executeOn(GraphExecutable.java:138)
        at schemacrawler.tools.executable.SchemaCrawlerExecutable.executeOn(SchemaCrawlerExecutable.java:123)
        at schemacrawler.tools.executable.BaseStagedExecutable.execute(BaseStagedExecutable.java:98)
        at schemacrawler.tools.commandline.SchemaCrawlerCommandLine.execute(SchemaCrawlerCommandLine.java:131)
        at schemacrawler.Main.main(Main.java:90)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
        at java.lang.ProcessImpl.create(Native Method)
        at java.lang.ProcessImpl.<init>(Unknown Source)
        at java.lang.ProcessImpl.start(Unknown Source)
        ... 9 more

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

I checked and the GraphViz\bin directory was not on the path. So I added it, confirmed it was working:

 dot -version
dot - graphviz version 2.38.0 (20140413.2041)
libdir = "C:\Program Files (x86)\Graphviz2.38\bin"
Activated plugin library: gvplugin_dot_layout.dll
Using layout: dot:dot_layout
Activated plugin library: gvplugin_core.dll
Using render: dot:core
Using device: dot:dot:core
The plugin configuration file:
        C:\Program Files (x86)\Graphviz2.38\bin\config6
                was successfully loaded.
    render      :  cairo dot fig gd gdiplus map pic pov ps svg tk vml vrml xdot
    layout      :  circo dot fdp neato nop nop1 nop2 osage patchwork sfdp twopi
    textlayout  :  textlayout
    device      :  bmp canon cmap cmapx cmapx_np dot emf emfplus eps fig gd gd2 gif gv imap imap_np ismap jpe jpeg jpg metafile pdf pic plain plain-ext png pov ps ps2 svg svgz tif tiff tk vml vmlz vrml wbmp xdot xdot1.2 xdot1.4
    loadimage   :  (lib) bmp eps gd gd2 gif jpe jpeg jpg png ps svg

and ran schemacrawler.cmd again. It still cannot find dot. Help?

sualeh commented 6 years ago

The SLF4J warning is spurious, and not related to dot not being found. Did you open a new ConEmu window after adding the Graphviz bin directory to the path? If this is still not working, you can try the following workaround:

  1. Run SchemaCrawler manually, using something like schemacrawler.cmd -server=mysql -database=foo_db -host=barbaz.rds.amazonaws.com -port=3306 -user=theuser -infolevel=standard -command=schema -portablenames -title "Blah" -Gdpi=300 -outputformat=scdot
  2. Run Grahviz manually, using a command-line like dot -T pdf <DOT path and filename>
sualeh commented 6 years ago

Phil, did that work for you?

philCryoport commented 6 years ago

Hi @sualeh ,

I actually like your suggestion of outputformat=scdot and then using dot to convert to PDF 😀

That works like a champ! Thanks.

sualeh commented 6 years ago

I am glad you have a workaround, and thanks for closing the issue. However, I am curious if you ever got SchemaCrawler to call dot. I am unable to reproduce the issue.

philCryoport commented 6 years ago

Ran ...-outputformat=png -outputfile=graph.png -Gdpi=300 -loglevel=WARNING. Didn't get an error about not able to find dot. Instead graph.png ended up being 0KB and the following error appeared at the end (note WARNING: has nothing after it):

Apr 24, 2018 3:02:42 PM schemacrawler.tools.integration.graph.GraphProcessExecutor call
WARNING: