Cert++
Close

Custom named log files with Logger.getLogger versus default custom logs

Key Takeaway

A logger from Logger.getLogger(fileNamePrefix, category) writes every message that passes the "Custom Log Settings" filters and file targets into one custom-<prefix> file, whatever its level. Default custom logging splits messages into one file per level.

B2C Commerce scripts write their own messages to custom log files through the dw.system.Logger class. By default, messages are split by level into shared files such as custominfo and customerror. A logger from Logger.getLogger(fileNamePrefix, category) instead gives a feature its own named log file, so all of the feature's messages stay together.

Log categories

Categories form a hierarchy. For example, product.import is a subcategory of product. Every category is a subcategory of the root.

A category name passed to Logger.getLogger(category) may contain only alphanumeric characters and dots (.).

B2C Commerce Developer Study Guide

Checklist progress

0/237Learned

Given a logging task and existing configuration, write code that logs non-sensitive data to custom log files with different log levels

0/4

Prepare for the Exam

Play Today's Certle

Study Community

Ask questions and get the latest info from other B2C Commerce Developer studiers. 796 members and growing.