<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>中文Flex例子 &#187; logging</title>
	<atom:link href="http://blog.minidx.com/tag/logging/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.minidx.com</link>
	<description>中文Adobe Flex例子,Flex实例教程,RIA资源,全文检索技术,算法和数据结构</description>
	<lastBuildDate>Thu, 31 Mar 2011 03:22:33 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>一个有用的Java log输出函数</title>
		<link>http://blog.minidx.com/2008/02/21/503.html</link>
		<comments>http://blog.minidx.com/2008/02/21/503.html#comments</comments>
		<pubDate>Thu, 21 Feb 2008 15:54:45 +0000</pubDate>
		<dc:creator>Minidxer</dc:creator>
				<category><![CDATA[程序开发相关]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[logging]]></category>
		<category><![CDATA[函数]]></category>
		<category><![CDATA[源代码]]></category>

		<guid isPermaLink="false">http://blog.minidx.com/2008/02/21/503.html</guid>
		<description><![CDATA[java.util.logging为我们提供了功能强大的log输出类，同时也有其他的像log4j这样的优秀log输出模块可以使用，但是有些时候我们可能仅仅是想要一个临时的文件信息输出功能，并不希望需要额外的import其他的库，IO这个类一般很少有不import的，所以下面的static函数放到自己的class中，就可以直接调用了。








下面是函数代码：
/*
* desc: output log message
*
* @param iLogFile&#160;&#160; log file path
* @param iMsg&#160; &#160; &#160; &#160; output message
* @return none
*/
public&#160;static void logPrint(String iLogFile, String iMsg) {
FileWriter&#160;out = null;
&#160;
try&#160;{
if(iLogFile == null)
{
iLogFile = &#34;c:\\m_log.txt&#34;;
}
// create file object
File&#160;oFile = new File(iLogFile);
out = new&#160;FileWriter(oFile, true);
// print message
out.write(iMsg+&#34;\n&#34;);
// close
out.close();
}&#160;catch (IOException e) {
System.out.println(&#34;file I/O error&#34;);
System.out.println(e);
}
}
使用例：
logPrint(&#34;c:\\sample.log&#34;, &#34;only a sample!&#34;);
或者
logPrint(null, &#34;only a sample!&#34;);
你可能还对下列文章感兴趣:利用xSocket, Java和Flash [...]]]></description>
		<wfw:commentRss>http://blog.minidx.com/2008/02/21/503.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (enhanced)
Database Caching 2/10 queries in 0.053 seconds using disk
Object Caching 155/313 objects using disk

Served from: blog.minidx.com @ 2012-02-09 18:19:06 -->
