Search code examples
loggingcronjobssap-commerce-cloud

Where does Hybris store the Cronjob logs by default?


I would like to know the process of the default Cron Job logging mechanism. As I see it is possible to download a log file for each job run as a zip, which contains the results and details of the actual run.

My questions: Where does Hybris store the *.log and *.zip files by default?

My reason for asking is that I would like to involve these log files in a centralized logging system with the standard tomcat logs as well, so that could be really helpful to be able to reach these files in the filesystem.


Solution

  • Where does Hybris store the *.log and *.zip files by default?

    Logs files store as media. CronJob has the one-to-many relationship with LogFile. Here LogFile extends Media.

    Declaration

    <collectiontype code="LogFileCollection" elementtype="LogFile" autocreate="true" generate="true"/>
    
    <itemtype code="CronJob" jaloclass="de.hybris.platform.cronjob.jalo.CronJob"
        extends="GenericItem" autocreate="true" generate="true">
        <deployment table="CronJobs" typecode="501" />
        <attributes>
            //.....
    
            <attribute qualifier="logFiles" type="LogFileCollection">
                <modifiers read="true" write="true" optional="true"
                    dontOptimize="true" partof="true" />
                <persistence type="jalo" />
                <description>A list of log files related to the current CronJob</description>
            </attribute>
    
            //.....
        </attributes>
    </itemtype>
    

    Logfile

        <itemtype code="LogFile" extends="Media" jaloclass="de.hybris.platform.cronjob.jalo.LogFile" autocreate="true"
                  generate="true">
    
            <attributes>
                <attribute redeclare="true" qualifier="owner" type="CronJob">
                    <modifiers read="true" write="false" initial="true" optional="false" private="false"/>
                    <persistence type="cmp" qualifier="ownerPkString"/>
                </attribute>
            </attributes>
        </itemtype>