locked
Enable logging the failure event on application logs for all Logshipping Jobs RRS feed

  • Question

  • As we are facing issues with Alerts, as they are not Firing Alerts on Failures and writting Application Logs, Can some Provide script to enable Notifications to write Applucation error logs when Log shipping job fails, Please find below script to obatain information for which jobs Notifications are not enabled when Job Fails

    SELECT

          name AS JobName

          , "Enabled" =

                CASE

                      WHEN enabled=1 THEN 'Yes'

                      WHEN enabled=0 THEN 'No'

                END

          ,notify_level_eventlog AS NotifyLevelEventLog

          , "Description" =

                CASE

                      WHEN notify_level_eventlog=0 THEN 'No Logging'

                      WHEN notify_level_eventlog=1 THEN 'Log Success'

                      WHEN notify_level_eventlog=2 THEN 'Log on Failure'

                      WHEN notify_level_eventlog=3 THEN 'Log on Either Result'

                END

    FROM msdb..sysjobs WITH (NOLOCK)

    Thanks,

    Maddy

    Monday, April 23, 2012 9:04 PM

Answers

  • Pretty easy, all you need to do is update the notify_Level_eventlog field for any job name you are interested in

    UPDATE msdb..sysjobs
     SET [notify_level_eventlog] = 2
     WHERE [name] = 'Job Name'


    Chuck

    • Proposed as answer by Iric Wen Tuesday, April 24, 2012 9:16 AM
    • Marked as answer by Iric Wen Wednesday, May 2, 2012 9:51 AM
    Monday, April 23, 2012 10:55 PM

All replies

  • Pretty easy, all you need to do is update the notify_Level_eventlog field for any job name you are interested in

    UPDATE msdb..sysjobs
     SET [notify_level_eventlog] = 2
     WHERE [name] = 'Job Name'


    Chuck

    • Proposed as answer by Iric Wen Tuesday, April 24, 2012 9:16 AM
    • Marked as answer by Iric Wen Wednesday, May 2, 2012 9:51 AM
    Monday, April 23, 2012 10:55 PM
  • Thanks
    Sunday, April 29, 2012 7:44 PM