0
votes

In my application, I need to write the logs to SharePoint, as we know, in SharePoint 2010, it's easy to write the logs by using WriteTrace() and WriteMethod() methods, but in SharePoint 2007, we don't have the direct way to write logs, but I found the helpful article here.

So here is the problem, as you know, the WriteTrace() and WriteMethod() methods are not recognised in SharePoint 2007, when we compile the code, it will throw the errors. But I don't want to separate the code into two parts, one for 2010 and the other for 2007. Any ideas for a good solution? Thanks!

1

1 Answers

5
votes

You will need to separate the code. However, as a good design, you can refactor only the log tracing code into its own assembly and then load that assembly at the runtime using the Factory or Abstract Factory Design pattern.