The logging framework doesn't have info about your method boundaries, and so it cannot format the XML appropriately. You can try to extend the framework and pass the additional info into the logging methods.
The easier way to get this output though is to perform all the message formatting in your aspect class and configure the logging framework to output only the message text without any other info.
For example, in log4net configuration:
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%message%newline" />
</layout>
In your aspect's OnEntry method you would open the XML tag (or JSON object), and in the OnExit method close the tag. You can start with the simple example below and optimize the code for your particular case (e.g. initialize the logger instance and formatting strings in RuntimeInitialize, CompileTimeInitialize methods).
[Serializable]
public class XmlLogAttribute : OnMethodBoundaryAspect
{
public override void OnEntry(MethodExecutionArgs args)
{
ILog log = LogManager.GetLogger(args.Method.DeclaringType);
if (log.IsDebugEnabled)
{
log.DebugFormat("<Method name=\"{0}\">", args.Method.Name);
log.Debug("<Params>");
foreach (object methodArgument in args.Arguments)
{
if (methodArgument == null)
{
log.Debug("<null/>");
}
else
{
log.DebugFormat("<{0}>{1}</{0}>", methodArgument.GetType(), methodArgument);
}
}
log.Debug("</Params>");
}
}
public override void OnExit(MethodExecutionArgs args)
{
ILog log = LogManager.GetLogger(args.Method.DeclaringType);
log.Debug("</Method>");
}
}