need to allwo for custom location of liscense and log4j.xml

14 views
Skip to first unread message

Kara Rawson

unread,
Aug 3, 2009, 1:28:21 PM8/3/09
to streamhub-comet-...@googlegroups.com
okay, so im trying to embed the entire comet server into a war file to
be deployed onto tomcat. Due to how tomcat works, i will have to
manually copy the two files into the proper location on tomcat install
dir. Thsi isn't portable to the point where i would just like to have to
copy over the war file on new deployments, and not to have to remeber to
also copy over the additional resources. embedding this is a must. could
this be addressed in a patch or minor update to the API?

kara

StreamHub Team

unread,
Aug 3, 2009, 2:21:54 PM8/3/09
to StreamHub Comet Server Community
Thanks Kara,

Yes, this seems like something that a lot of people will want to do.
We will see about doing a minor release sometime this week. We could
add a couple of extra constructor arguments (Strings) which then
internally do a getResourceAsStream() - would this suit you? Where in
the WAR are you going to include the license and log4j files?

Kara Rawson

unread,
Aug 3, 2009, 3:25:27 PM8/3/09
to streamhub-comet-...@googlegroups.com
honestly what would be the best solution is to have logging built into
streamhub, and to create a new package called com.streamhub.Log. This
should be static, and loaded automagically by your main(). Debug should
be off by default, and to turn it on you could do something like
Log.setDebug(true || false). Since thsi would be a static method it
would just toggle log4j on or off. Additional logging methods can be
crafted to handle or trigger certain events for logging, or UID's or
specific publishes....etc.. you get the idea. This i think would make
the app alot faster to config and port around. Im pretty sure you can
include log4j into your app with there current liscense, so that
shouldn't be a problem.

and as far as your liscense is concerned, including it witghin the same
directory of your streamhub-xxx.jar file would be great. Having a name
such as streamhub-xxx.liscense would be more obfuscate then just a
liscense.txt. But since we are on that route, then best possible way for
you to store your liscense key is in a jar file. You then can protect
and encrypt this jar file, it literary can have one two files in it, a
warpping java class which loades a prop file, and the prop file in the
jar which contains your liscense data, the java wrapper then dynamically
loads this prop file.

you can easily create a process to automagically create these jar files.
Then ship those to the customer. Then when the customer loads in the
streamhub-xxx.jar, you also havet hem include the liscense jar as well.
Alot of other well know java APIs do it this was, with great success.

but for now, yes a getResourceAsStream would work fine, a little round
about, but it will work. they just need to be somewhere in your
classpath, playing around with it a little bit should show what and
where you can put em. i cant test this or i could tell you exactly where
to put em. i think it would be faster to create the new package then to
monkey with the resource loaders.

kara

StreamHub Team

unread,
Aug 7, 2009, 9:24:08 AM8/7/09
to StreamHub Comet Server Community
Hi Kara,

In 2.0.3 its now possible to load the license and log4j configuration
from a URL which could be a file, a JAR, a classpath URL or a remote
location. We've written a blog article below on how to use this
feature:

http://streamhub.blogspot.com/2009/08/loading-license-and-log4j-configuration.html

We use log4j because its well-known in the industry and almost a
standard when it comes to Java logging. The configurability of log4j
allows the end user to configure almost every aspect of the logging in
StreamHub - the size of the log file, the rollover size, the number of
rolled-over logs, the logging level and add custom appenders to log to
a console, a database, a remote service etc... If you wish to turn it
off or toggle debug, you just need to change the log4j.xml shipped in
the conf folder of the SDK. To run on debug level logging change the
"com.streamhub" logger to:

<logger name="com.streamhub" additivity="false">
<level value="debug" />
<appender-ref ref="file" />
</logger>

To turn off logging completely, change it to:

<logger name="com.streamhub" additivity="false">
<level value="off" />
<appender-ref ref="file" />
</logger>

For more information on the various XML config options, this guide has
some good examples:

http://wiki.apache.org/logging-log4j/Log4jXmlFormat

I hope the new features give you the flexibility you need to embed
StreamHub in your WAR, if not please let us know.

Thanks,
The StreamHub Team

Kara Rawson

unread,
Aug 7, 2009, 10:07:51 AM8/7/09
to streamhub-comet-...@googlegroups.com
okay great ill check it out.

kara
Reply all
Reply to author
Forward
0 new messages