Cling Workbench: logging to console

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view

Cling Workbench: logging to console

Dear Mr. Bauer,

Is there any way to make the Cling Workbench log to the console?

I tried launching  it with:

java -Djava.util.logging.config.file=C:\ -jar cling-workbench-1.0-beta1-standalone.jar

And my own logging properties file, but it had no effect at all.

The reason I ask is that sometimes the Workbench terminates suddenly, leaving me with no log.  The termination scenario I have is that I am trying invoke 'Use Service' on my own dummy MediaServer device which doesn't yet have methods implemented.  That isn't a worry, but it would be nice to see which method Workbench was trying to invoke at the time.

By the way, I have been trying to experiment using Windows Media Player as my example Content Directory, but it is very reluctant to appear in the Cling Workbench, though eventually it always does.  I am fairly certain this is a Media Player problem.  I just wondered if you had noticed it?  I guess as a Mac user you will not have.

Thank-you for Cling!

- Crosbie
Reply | Threaded
Open this post in threaded view

Re: Cling Workbench: logging to console

Christian Bauer
Hey Crosbie, unfortunately there is no easy answer to your question about logging.

You won't be able to override/configure the logging with beta2. The workbench will always use its own logging configuration on startup. I've just now committed a change to SVN (beta3) which allows you to use your own file. So you will have to build all of Cling from SVN at this time to get it working. I'll release beta3 next week.

Once you have beta3, you can start it as follows with your custom

/cling/trunk$ java \
  -cp ~/.m2/repository/org/teleal/teleal-common/1.0.5/teleal-common-1.0.5.jar: \ 
 core/target/cling-core-1.0-beta3.jar:support/target/cling-support-1.0-beta3.jar: \ 
 workbench/target/cling-workbench-1.0-beta3.jar \ 

You can not use the -standalone.jar for this but you will have to provide all the JARs individually on the classpath! The java.util.logging implementation in the JDK is broken, it uses the wrong classloader to load handlers specified in the properties file and the standalone.jar provides a different classloader which JUL doesn't like.

Here is the I've used:




With beta3 you should see all of the log messages on your console, as well as in the UI. You can even configure the levels in the UI logging options while the application is running (or in the properties file for categories not supported by the UI).

About the crashing workbench: You should see a stacktrace when an uncaught exception occurs in your plugin code. This is what happens when the workbench exits:

public void handle(Throwable ex) {
    System.err.println("===================== The application threw an unhandled exception, exiting... ==============================");

I haven't had time to think about this so improved exception handling in the workbench is currently a TODO item.

As for your windows media player, I remember I've seen this behavior before. I think windows has seriously broken multicast support and there is also something wrong with "authorization" for UPnP search responses. I bet you saw a very obscure dialog pop-up at some point that asked for access permissions to WMP (you'll never find that dialog again). If you click Refresh in the workbench, a multicast search is send to all devices and you should see UDP packets coming in from everyone. If windows doesn't send one, it's a networking/WMP problem, not in Cling.
Reply | Threaded
Open this post in threaded view

Re: Cling Workbench: logging to console

I'll try beta3 when you release it, or next time it annoys me, whichever comes first!  Exceptions aside, I like having logs in a file.  Thank-you very much!