3

While debugging core Liferay 6.2 issues, we are faced with issues in viewing logs. Liferay doesn't show error logs unless we explicitly enable them.

These are the steps we follow to enable specific logs:

  1. Go to Control Panel > Server Administration > Logs. Search for package and change log-level to ALL
  2. Liferay logging level

Is there any other way to enable logs for all packages in Liferay?

Community
  • 1
  • 1
Ashok Goli
  • 5,043
  • 8
  • 38
  • 68

2 Answers2

2

You can add a new package in this very section of the control panel. For example you can add a new log for "com.liferay" and set the level to ALL. This will show all the traces for all the packages under com.liferay.

But I think you don't really want to activate the log at com.liferay depth as far as it will flood your catalina.out ant it will be really difficult to read.

aritzg
  • 39
  • 2
1

There's an underlying log4j implementation - of course you can configure it just as you want.

If you are asking about changing it programmatically at runtime: Liferay's UI does so as well. My best bet without looking at the code is that it's using Log4JUtil, which you might be able to use as well.

As I don't know your criteria for enabling/disabling, try using this. Or let us know when/how you'd like to configure the logging system (e.g. always the same levels up to DEBUG level whenever a certain condition appears?)

Olaf Kock
  • 46,930
  • 8
  • 59
  • 90
  • Thanks for the direction. So to configure the log level of all packages at runtime - the recommendation here is to use Log4JUtil from the Server Script Console - right? I'm looking to change the log level of ALL packages in Liferay - possibly through Control Panel. – Ashok Goli Feb 01 '16 at 22:50
  • The specific problem we are facing is identifying the root cause of a few issues we are facing while working with Liferay. If we don't know which packages to enable the log levels, changing the root log level to ALL might be a solution. Without ext or portal log ext file or a server restart, I didn't see any other alternative. But I'll definitely give this Log4JUtil script a shot. – Ashok Goli Feb 01 '16 at 22:53
  • Sounds like you're changing the problem from a debugging-problem to a logfile-parsing-problem. Let us know how many GB of logs you analyze. – Olaf Kock Feb 01 '16 at 22:58
  • This is definitely not a log file parsing error :) The specific issues that we faced recently printed logs only when we explicitly enable them in Server Admin. Was just looking for a short term solution to print logs of all packages in Debug or a lower log level. – Ashok Goli Feb 01 '16 at 23:01
  • I didn't mean to say that it's a log file parsing error. It's a log file parsing problem as you won't debug any more, you'll rather have to parse log file then, and they will be huge – Olaf Kock Feb 01 '16 at 23:22
  • Got it. Printing all logs would bloat the file size to GBs. Definitely a yes. But is there any other way to print errors that generally won't turn up in the logs and we have no idea where to analyse? I'm going to give it a shot anyways - just to see if I can get it right ;) – Ashok Goli Feb 01 '16 at 23:25