Python:如何将日志文件保存到SharePoint



我目前在Python脚本中有一个日志,如下所示:

logging.basicConfig(filename = 'C:\Users\Public\Pilot_Log.txt', level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')

我希望能够将日志文件直接保存到SharePoint上,而不是将其保存到用户的本地驱动器上。我试过这样的东西,但失败了:

logging.basicConfig(filename = 'https:\office2.xyz.com\sites\Test\Shared Documents\Pilot_Log.txt', level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')

如何将日志文件直接保存到SharePoint?

我想明白了。我没有从浏览器中发布日志文件的URL,而是在Windows资源管理器中打开文件夹,右键单击该文件,并使用"属性"下的"位置"。

logging.basicConfig(filename = '\\office2.xyz.com@SSL\DavWWWRoot\sites\Test\Shared Documents\Pilot_Log.txt', level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')

它如预期的那样工作。

最新更新