3

Error message showing in Tridion UI is different and message showing in log file is different. So we want to capture log file data while publishing. is there API to capture logs while publish fails? like event extension ? Apart from below files cd_deployer.log cd_core.log

1

Where in the publish steps appears this error?

If the error appears in Deploying or Commiting Deployment, you should search in Deployer Service's logs (cd_deployer.log and cd_core.log)

If the error appears in trasporting step you sould search in event viewer or %TRIDION_HOME%\log\cd_transport.log

You can change the log level modifying logback.xml file.

| improve this answer | |
1

You can use the Core Service to programatically access the items in the Tridion Publish Queue and get additional information about the item and the message the Publishing UI shows. Check the code below taken my Publish Queue Monitor Project. It should provide you an idea an starting point for accessing that type of information.

However, it will not get the Deployer log information for you, since those failure details are only found within the Deployer logs.

I'd suggest to possibly use something like LogEntries and send the failures to it.

For my scenario, I used their Log4Net extension. It's painfully simple to setup and use with .Net. You can also do something similar with the Java side, possibly using a File extension from LogEntries (to monitor the Deployer Logs (we do that too) and then you can set an alert based on some text within the log file. Finally, logentries lets you send emails to people when an 'alert' goes off based on a regular expression.

Core Service Code to Scan the Publish Queue...from Publish Queue Monitor Project

  private List<PublishQueueItem> GetPublishQueueItemsInLastPeriod(CoreServiceClient client)
        {
            var filter = CreateFilter();

            XElement publishTransactions = client.GetSystemWideListXml(filter);
            List<PublishQueueItem> pubQueueItems = new List<PublishQueueItem>();
            foreach(XElement queueItem in publishTransactions.Descendants())
            {
                pubQueueItems.Add(new PublishQueueItem()
                {
                    ID = queueItem.Attribute("ID").Value,
                    Title = queueItem.Attribute("Title").Value,
                    ItemUri = queueItem.Attribute("ItemID").Value,
                    User = queueItem.Attribute("User").Value,
                    Publication = queueItem.Attribute("Publication").Value,
                    PublicationTarget = queueItem.Attribute("PublicationTarget").Value,
                    ItemPath = queueItem.Attribute("ItemPath").Value
                });
            }
            return pubQueueItems;
        }

        private static PublishTransactionsFilterData CreateFilter()
        {
            int timePeriod = Int32.Parse(ConfigurationManager.AppSettings["PubQItemsInLastXSeconds"]);
            var filter = new PublishTransactionsFilterData();
            filter.StartDate = System.DateTime.Now.AddSeconds(-(timePeriod));
            filter.EndDate = System.DateTime.Now;

            // Success and Failed are mostly used for testing when we don't have items stuck in rendering
            string publishState = ConfigurationManager.AppSettings["PublishState"];

            if (publishState == "Rendering")
            {
                filter.PublishTransactionState = PublishTransactionState.Rendering;
                //logger.WriteEntry("Rendering Phase");
            }
            else if (publishState == "Failed")
            {
                filter.PublishTransactionState = PublishTransactionState.Failed;
                //logger.WriteEntry("Failed Phase");
            }
            else if (publishState == "Success")
            {
                filter.PublishTransactionState = PublishTransactionState.Success;
                //logger.WriteEntry("Success Phase");
            }
            return filter;
        }
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.