Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

OO Wrapper for Application Log

Former Member
0 Kudos

I want to know if there is an object-oriented way of creating and adding messages to an application log.  The current method requires every program to maintain a handful of variables that would be easily managed by an object, but there's no mention of such a class in the sap documentation:   Application Log – Guidelines for Developers (BC-SRV-BAL).

A coworker of mine created a global class to handle that in our system and it works well, I just want to know if anyone else is doing that or if SAP has a standard class for such purposes. 

Thanks,

Eric

1 ACCEPTED SOLUTION

ceedee666
Active Contributor
0 Kudos

Hi Eric,

just wanted to answer to your initial question regarding a custom class for logging to the application log.

We created a global class in our systems. This advantage is that we collected common functionality around logging (e.g. adding bapi messages to the log, logging exceptions) in a central place. As far as I know none of the standard sap classes provides this functionality. Furthermore it is possible to use the class across different SAP solutions like CRM and ERP. That way the code around logging is nicely standardized across all our custom development.

Christian

4 REPLIES 4

mh97
Contributor
0 Kudos

Hi Eric,

Take a look at CL_LOG_PPF.

I used the application once and for some reason created my own class.However a leftover comment references CL_LOG_PPF.  Also you may want to do a where-used on the key function modules, e.g.

BAL_LOG_MSG_ADD_FREE_TEXT.

I probably copied my class from the one used for workflow extended notifications and adjusted it for my purpose. But I agree with you it would be nice if there were an easy-to-use standard class.

I'm bookmarking this thread in case someone else adds good info!

Margaret

Former Member
0 Kudos

Well, I have an update.  I did a where-used for classes that called FM 'BAL_LOG_CREATE' and got way more than I bargained for.  About one hundred or so modules wrote their own class to interface with the application log, and they all rely on different assumptions.  I found three classes written by former coworkers and consultants, and a standard one that looked promising called CL_EZLOG.  It works fine but doesn't have functionality for free text and class-based exception logging.

I've decided that since my program will be used for workflow extended notifications, I'll use CL_SWN_LOG.

I probably should have done a where-used on BAL_LOG_MSG_ADD_FREE_TEXT since that is less common but would be included in a good utility class.  Maybe that'll happen in the future.

ceedee666
Active Contributor
0 Kudos

Hi Eric,

just wanted to answer to your initial question regarding a custom class for logging to the application log.

We created a global class in our systems. This advantage is that we collected common functionality around logging (e.g. adding bapi messages to the log, logging exceptions) in a central place. As far as I know none of the standard sap classes provides this functionality. Furthermore it is possible to use the class across different SAP solutions like CRM and ERP. That way the code around logging is nicely standardized across all our custom development.

Christian

Former Member
0 Kudos

Hello Christian,

Could you share us the source of you global logging class. It will be nice to look on and take it as a base of own logging.