(This solution creates a custom logger for all AMF transactions using
log4j.):

Step 1: Create a java class for Flex logging on server side

import flex.messaging.log.LineFormattedTarget;

public class FlexLogger extends LineFormattedTarget
{
    private final static Logger logger =
LogFactory.getInstance().getLogger("FlexMessagesLogger");

    public FlexLogger()
    {
        super();
    }

    protected void internalLog(java.lang.String message)
    {
        logger.debug(message);
    }
}

Step 2: Do following entry in log4j.xml :

 <appender name="FlexMessagesLogAppender"
class="org.apache.log4j.DailyRollingFileAppender">
        <param name="Append" value="false" />
        <param name="DatePattern" value="yyyyMMdd" />
        <param name="File" value="${log.path}/flex-messages.log" />

        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%d,%m%n" />
        </layout>
    </appender>

<logger name="FlexMessagesLogger">
        <level value="debug" />
        <appender-ref ref="FlexMessagesLogAppender" />
    </logger>

Step 3: Do following entry in services-config.xml in flex project:

<logging>
        <target class="somepackage.FlexLogger" level="debug">
            <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>
            </filters>
        </target>
    </logging>

This should record all AMF transactions in "flex-messages.log" at server.
One thing to make sure here is that log4j is confirgured correctly, else the
logs would not be created.

-Ashish

On Wed, Oct 13, 2010 at 2:24 PM, <[email protected]> wrote:

>
> http://blog.flexexamples.com/2007/08/26/debugging-flex-applications-with-mmcfg-and-flashlogtxt/
>
> On Tue, Oct 12, 2010 at 22:35, Vatsala Dorairajan <[email protected]
> > wrote:
>
>>  HI Everyone,
>> Is it possible to generate log files for the trace() statements in Flex
>> like in Java applications? If so how to do it?
>>
>> vatsala
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Flex India Community" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected]<flex_india%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/flex_india?hl=en.
>>
>
>
>
> --
> Fear is an illusion, So, face it !
> RM3sh
>
> --
> You received this message because you are subscribed to the Google Groups
> "Flex India Community" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<flex_india%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/flex_india?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en.

Reply via email to