Depending on your specific use case, it may be easier to simply log to a well-known location on the system and point the user to that location. At least one problem with trying to figure out the location programatically is that a single logger can log to multiple sources at once, e.g. multiple files or to a database.
Regardless, you can probably use the following sequence(note: I have not tried this myself)
- Get the logger that you want to get the appender for(that is, you must have a logger that logs to the file you want to get the name of)
- Use logger.getAppender( std::string name ) or logger.getAppenders() and loop through all of the appenders.
- Figure out which of the appenders is a FileAppender: https://logging.apache.org/log4cxx/latest_stable/apidocs/classlog4cxx_1_1_file_appender.html (I think you need to use dynamic_cast here, but I'm not positive, I don't do much casting in C++)
- Call the FileAppender.getFile() method.