public void FindAndRender()

in src/log4net/ObjectRenderer/RendererMap.cs [99:152]


		public void FindAndRender(object obj, TextWriter writer) 
		{
			if (obj == null)
			{
				writer.Write(SystemInfo.NullText);
			}
			else 
			{
				// Optimisation for strings
				string str = obj as string;
				if (str != null)
				{
					writer.Write(str);
				}
				else
				{
					// Lookup the renderer for the specific type
					try
					{
						Get(obj.GetType()).RenderObject(this, obj, writer);
					}
					catch(Exception ex)
					{
						// Exception rendering the object
						LogLog.Error(declaringType, "Exception while rendering object of type ["+obj.GetType().FullName+"]", ex);

						// return default message
						string objectTypeName = "";
						if (obj != null && obj.GetType() != null)
						{
							objectTypeName = obj.GetType().FullName;
						}

						writer.Write("<log4net.Error>Exception rendering object type ["+objectTypeName+"]");
						if (ex != null)
						{
							string exceptionText = null;

							try
							{
								exceptionText = ex.ToString();
							}
							catch
							{
								// Ignore exception
							}

							writer.Write("<stackTrace>" + exceptionText + "</stackTrace>");
						}
						writer.Write("</log4net.Error>");
					}
				}
			}
		}