Capturing Errors in FME Server Log files

Can someone please explain how I can capture the Errors in the log file created by FME Server using Python. From what I have read I am still not sure if the python has to go in the startup, shutdown or PythonCaller transformer to capture any errors while it is running. I am also not a python developer so would appreciate a full working script or an example Workspace if possible? I am using FME 2016.

Since Python standard library doesn't support Oracle database connection, you will have to obtain additional module such as "cx_Oracle" and configure your FME Server so that the additional module can be run.I myself have never experienced that, so cannot help you unfortunately. See a relevant section in FME Server documentation, and ask help of other experts if necessary.Although it should be theoretically possible to connect Oracle database using a Python script, it could be a little troublesome to configure the environment of FME Server. If I were you, I would try first the method that uses the FMEServerJobSubmitter and FMEServerLogFileRetriever, in order to avoid make FME Server maintenance more complex.

Hi @takashi, I forgot to mention that I need to write the errors into an Oracle table but I am not sure how I could do this until I get some example output data. Also, as I had in another question, the LogMessageStreamer was what I was trying to use but found it difficult to get it to run at the end of the script to capture all the errors.

In the case, I think it would be easy to create another workspace containing the FMEServerJobSubmitter and the FMEServerLogFileRetriever as I commented in the previous answer, if FME 2016 supported those transformers.

Regarding the LogMessageStreamer, I don't think it's suitable to your purpose because it has this limitation "Messages outside the lifetime of the transformer cannot be captured" -- LogMessageStreamer Help.Vote up this idea :-) ErrorCatcher Transformer

# Shutdown Python Script
# Do something using the collected error messages.
# e.g. overwrite the log file with the error messages if there were one or more errors.
import fme
if 0 < len(errors):
with open(fme.logFileName, 'w') as f:
f.writelines(errors)

I don't remember if FME 2016 has the FMEServerLogFileRetriever, but if there were, you could also create another workspace to run the workspace with an FMEServerJobSubmitter and retrieve the entire translation log as an attribute using the transformer. Since the log is a plain text, you can parse/analyze it to retrieve required parts.