주요 콘텐츠

opc.ua.saveClientLog

R2026b

Save OPC UA client debug logs to file

Since R2026b

    Description

    destFilePath = opc.ua.saveClientLog saves OPC UA client debug logs to a file in the current directory and returns the full file path of the saved log file. The default file name is opcuaClient_<current-timestamp>.txt. Before using this function, you must first enable debug logging by setting the DebugLogging property of an OPC UA client to true.

    example

    opc.ua.saveClientLog(destFile) saves logs to the text file specified by destFile.

    example

    Examples

    collapse all

    Create an OPC UA client with debug logging enabled and connect the client to an OPC UA server.

    uaClnt = opcua("localhost",62550,ClientLogging=true);
    connect(uaClnt);

    Save client debug logs to a file. The function saves the logs to a new file in the current directory. The default file name is opcuaClient followed by the current timestamp.

    savedLogAt = opc.ua.saveClientLog
    savedLogAt = 
    
        "C:\User1\Examples\OPCUA\opcuaClient_2026-02-20T15-19-54.txt"
    

    Create an OPC UA client with debug logging enabled and connect the client to an OPC UA server.

    uaClnt = opcua("localhost",62550,ClientLogging=true);
    connect(uaClnt);

    Save client debug logs to a specified location by providing the file name and path. If the specified file contains data, the function overwrites the file content with the generated logs.

    logSavedAt = opc.ua.saveClientLog("C:\User1\Logs\OPCUA\Client432Log.txt")
    logSavedAt = 
    
        "C:\User1\Logs\OPCUA\Client432Log.txt"
    

    Create an OPC UA client with debug logging enabled and connect the client to an OPC UA server.

    uaClnt = opcua("localhost",62550,ClientLogging=true);
    connect(uaClnt);

    Save client debug logs to a file. The function saves the logs to the specified file in the current directory. If the specified file does not exist in the current working directory, the function creates a file with the specified name and saves the logs to the file. The output provides the full path to the log file.

    filePath = opc.ua.saveClientLog("Client242Log.txt")
    filePath = 
    
        "C:\User1\Examples\OPCUA\Client242Log.txt"
    

    Input Arguments

    collapse all

    Filename to save generated client logs, specified as a string or character vector. When you specify only a file name, the function saves the log to the specified file name in the current directory. To save the logs in a file at a custom location, specify the full file path.

    Example: opc.ua.saveClientLog("Log1.txt")

    Example: opc.ua.saveClientLog("C:\Users\OPCLogs\Nov26\Log1.txt")

    Data Types: char | string

    Output Arguments

    collapse all

    Full file path of the saved client log file, returned as a string.

    Version History

    Introduced in R2026b

    See Also

    Functions