简体   繁体   中英

How to save xml error message in log file?

When I access xml, there is error message like this :

<ErrorMSG>Credit limit exceed. Booking cannot be proceed. </ErrorMSG></Response>

I want save the error message in log file

How to save xml error message in log file?

Thank you

You might want to look at file_put_contents() if you want something super quick:

file_put_contents('<path to log file>', $stringInput, FILE_APPEND);

Where "path to log file" is the path + name of the file you want to write to, and $stringInput is the string representation of the error. FILE_APPEND is a flag so that every time you call file_put_contents(), a new line gets added to the file rather than rewriting the file.

As an alternative, check out log5php which gives more control.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM