Workers Troubleshooting Log Sample Code

JFrog Platform Administration Documentation

Content Type
Administration / Platform
ft:sourceType
Paligo

For a worker to generate log entries when the worker runs, you must use the console output in the worker scripts. For worker's sample code, see Artifactory Workers Code Samples.

The following section provides sample code for a Before Download Worker with debug (console.debug), info (console.info), error (console.error), and warning (console.warn) information captured for the log. Note that the log should follow the same order - debug, info, warn, and error.

{
export default async (context: PlatformContext, data: BeforeDownloadRequest): Promise<BeforeDownloadResponse> => {

   console.debug("This is a debug log line.");
   console.info("Log something");
   console.error("Something is wrong!");
   console.warn("It is getting serious!");
   return {
       status: 'DOWNLOAD_PROCEED',
       message: 'proceed',
   }
}
  1. From the Projects drop-down list, click All Projects or your desired project.

  2. From the Administrator module, click Workers.

    The Workers page appears.

  3. Under the Troubleshooting tab, you can view the Run History of workers.

  4. Click the worker for which you want to view Summary and Logs.

    WorkersLogSampleCode.png