Occasionally, when a problem arises with an m-Power application it is necessary for the developer to investigate by reviewing the Tomcat log files. Historically, the only way to access these files was to first gain access to the m-Power server. The trouble with that is that some developers don’t have the ability (or desire) to access the m-Power server via Remote Desktop Connection (Windows), or via Terminal Session(Linux).
Recently, we created a solution to this problem: The Tomcat Logger utility. This utility allows a user to access Tomcat logs directly via the URL, without the need to access the m-Power server whatsoever. In practice, a feature like this allows developers the opportunity to quickly access log information to diagnose a problem or to obtain key information to send to mrc technical support. Put into use, this feature will greatly improve troubleshooting efforts and debugging without compromising security.
How to Install Tomcat Logger:
Step 1: Download the following jar file: https://www.mrc-productivity.com/techblog/mrc-files/mrctomcatlogger.jar
Step 2: Add the jar file to /mrcwebgui/WEB-INF/lib.
Step 3: Open /mrcwebgui/WEB-INF/web.xml in a text editor and add the following entry directly above the first servlet in the file:
<servlet> <servlet-name>tomcat_logger</servlet-name> <servlet-class>com.mrc.logging.TomcatLogger</servlet-class> </servlet> <servlet-mapping> <servlet-name>tomcat_logger</servlet-name> <url-pattern>/tomcatLogger</url-pattern> </servlet-mapping>
Step 4: If you want to secure this feature (recommended), add the following line to the existing <web-resource-collection> tag in the same web.xml file:
For more on these Tomcat credentials, please see here.
Step 5: Restart Tomcat.
Step 6: Access the servlet by adding /webapp/mrc/tomcatLogger to m-power’s IP address in a browser window.
Using Tomcat Logger
Now you’re ready to use Tomcat Logger. Initially, the application will appear similar to this screenshot:
The output can be customized by adjusting the Max Lines as well as setting (or removing) the frequency at which the Logger will refresh. You can also choose to display new lines at either the top or bottom of the page.