You found a shared host that "says no to the apache jars" but allows
'createObject("java"...'?
If they do now... they most likely won't for much longer.
-----Original Message-----
From: Dan Plesse [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 26, 2006 2:47 AM
To: CF-Talk
Subject: Poor mans Logger
This logger is for a CFer who is on a shared host and the host says no to
the apache jars and you don't feel like bothering with a classloader and
sending all your stuff via cfmail tags is not cool anymore. Maybe people
should get there own <cfmail dir too so they don't have to go around looking
at other people's mail just to hunt down all undeliv error messages.
<cfset Logger = CreateObject("java",
"java.util.logging.Logger").getLogger("hello")
/>
<cfset FileHandler = CreateObject("java", "java.util.logging.FileHandler
").init("C://hello.log",true)>
<cfset SimpleFormatter = CreateObject("java", "
java.util.logging.SimpleFormatter").init()>
<cfset FileHandler.setFormatter(SimpleFormatter)>
<cfset Logger.addHandler(FileHandler)>
<cfset Level = CreateObject("java", "java.util.logging.Level")>
<cfset Logger.setLevel(Level.parse("INFO"))>
<cfset Logger.setUseParentHandlers(false)>
<cfset LogRecord_message = CreateObject("java", "java.util.logging.LogRecord
").init(Level.parse("INFO"), "Hello World")>
<cfset FileHandler.publish(LogRecord_message)>
<cfset FileHandler.flush()>
<cfset FileHandler.close()>
If you want to add a props file and all that jazz go right ahead.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four
times a year.
http://www.fusionauthority.com/quarterly
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:254204
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4