Jared Rypka-Hauer, Lead ColdFusion Developer, Minneapolis, MN

Proud Parents of SQLSurveyor and PayPalMX
Viewing By Entry / Main
November 20, 2006 - back to top
I spent a few minutes the other day trying to figure out how to get Flex to use the servlet container log instead of the console log... turns out it's mindblowingly easy. All you have to do is edit {cf_home}/web-inf/flex/services-config.xml and change this:
<logging>
   <target class="flex.messaging.log.ConsoleTarget" level="Info">
      <properties>
         <prefix>[Flex] </prefix>
         <includeDate>false</includeDate>
         <includeTime>false</includeTime>
         <includeLevel>false</includeLevel>
         <includeCategory>false</includeCategory>
      </properties>
      <filters>
         <pattern>Endpoint.*</pattern>
         <pattern>Service.*</pattern>
         <pattern>Configuration</pattern>
         <pattern>Message.*</pattern>
      </filters>
   </target>
</logging>

to this:
<logging>
   <target class="flex.messaging.log.ServletLogTarget" level="Info">
      <properties>
         <prefix>[Flex] </prefix>
         <includeDate>false</includeDate>
         <includeTime>false</includeTime>
         <includeLevel>false</includeLevel>
         <includeCategory>false</includeCategory>
      </properties>
      <filters>
         <pattern>Endpoint.*</pattern>
         <pattern>Service.*</pattern>
         <pattern>Configuration</pattern>
         <pattern>Message.*</pattern>
      </filters>
   </target>
</logging>

And voila... any Tail-style application will let you watch your logs to your hearts content. Just be sure your log rotator is working and you don't do this in production unless you need to, because using the servlet log DOES save all that logging info to disk.

The reason I wanted to do it was that I hate having to start CF in a console window to watch the log. I have perfectly good log readers (including the GraySky LogWatcher plugin for FlexBuilder/Eclipse) and I don't really want to have extra windows open while I'm working.

Works really freakin well... enjoy!

Laterz!

Comments

Jared - I've linked to this post on my site (http://www.brightworks.com/technology/adobe_flex/with_java.html). I like to list author names. Could I get your last name?

Douglas McCarroll


Cool!

Rypka-Hauer


Quick question - What are your server settings to get this to log on the server. I am using JBoss





Aura skin for Raymond Camden's BlogCFC provided by Joe Rinehart.