Showing posts with label Logger. Show all posts
Showing posts with label Logger. Show all posts

Tuesday, April 17, 2018

User names in the sugarcrm.log instead of IDs

So normally the sugarCRM log file is filled with lines like this

Mon Apr 16 07:02:12 2018 [15900][412b8e70-febc-11e6-934a-52d504b662cb][FATAL] No Links found for relationship tasks_activities_1_tasks
Mon Apr 16 07:02:12 2018 [15900][420703ed-f2bc-e3f4-f906-566ef6f1e16d][FATAL] No Links found for relationship accounts_accounts_1
Mon Apr 16 07:02:12 2018 [15900][41a5d4a2-c01b-11e7-88b5-52d504b662cb][FATAL] No Links found for relationship cases_cases_1

Usually I am looking for an entry from a particular user so GUIDs are hard for old human eyes to read.  Even with FIND its a pain.  So I wrote this


This writes out a script and, when run, will rewrite the sugarcrm.log file with user_names instead of IDs.

So to use this you need to
  1. Copy this code to the root SugarCRM directory
  2. run it (php -f updateLog.php)
  3. Update the permissions on the file it creates (chmod 777 updateLog.sh)
  4. Run the script (./updateLog.sh)
Of course this only works on Linux or Mac and maybe the Linux Shell in windows, not sure abou thtat.  But anyway I like it and I hope up do to.

This could also be done in real time by overriding include/SugarLoggger/SugarLogger.php and changing the bit of code that write the line to the log file.  I can show that if anyone needs it, just ask.

Sunday, January 28, 2018

Developer Centric Logging

A few weeks ago I wrote some posts about overriding the CRON handler and I showed code about Developer Communication.   Since then I have talked to a few people and they all wanted to know what that cryptic function call did so I thought I would look into releasing it.   When I looked at the code I realized that I could not release it as it was crap.  So I took a week and rewrote it into this.  What we have here is a custom logger.  I found scant few examples of custom loggers on the internet so I hope someone finds this useful.

I think it adds all the missing pieces into SugarCRM's SugarLogger function like timers, headers, line tracing, email, and notifications.