. writelines (list)
Write the string in the list into the file one by one row.
Example
1. open or create a file
The code is as follows:
#! /Usr/bin/env python#-*-Encoding: UTF-8 -*-
Filehandler = open('test.txt ', 'w') # open the file in write mode. if the file does not exist, createFilehandler. write ('This is a file open/create test. \ nthe second line .')
Filehandler. close ()#! /Usr/bin/e
Tags: des HTTP Io ar OS Java for SP Overall: log files related to TomcatThe log file of the cataline engine. The file name is Catalina. Date. log.The log generated by the internal code in Tomcat. The file name is localhost. date. log (exception of internal error in JSP page, org. apache. jasper. runtime. httpjspbase. if the service class is thrown out, the log information is in this file !)Default Manager Application Log in Tomcat, file name manager. Date. LogLogs output by the console are redir
Elgg obtains the file icon address. The process is as follows: first, this method is used when the object is saved (the system itself): for example, there is an Activity class that inherits from ElggObject and creates an instance activity, the code copying process is as follows:
First, this method is used when the object is saved (the system itself ):
For example, an Activity class inherits from ElggObject and creates an instance activity,
The code is as follows:
// Now see if we have a file
The process is as follows:First, this method is used when the object is saved (the system itself ):For example, an Activity class inherits from ElggObject and creates an instance activity,Copy codeThe Code is as follows:// Now see if we have a file iconIf (isset ($ _ FILES ['icon ']) (substr_count ($ _ FILES ['icon'] ['type'], 'image /'))){$ Prefix = "activity/". $ activity-> guid;$ Filehandler = new ElggFile ();$
The process is as follows:
First, this method is used when the object is saved (the system itself ):
For example, an activity class inherits from elggobject and creates an instance activity,
CopyCode The Code is as follows: // now see if we have a file icon
If (isset ($ _ FILES ['icon ']) (substr_count ($ _ FILES ['icon'] ['type'], 'image /'))){
$ Prefix = "activity/". $ activity-> guid;
$ Filehandler = new elggfile ();
$
The process is as follows:
First, the entity is saved with this method (the system itself):
For example, there is an activity class that inherits from Elggobject, creating an instance of it activity,
Copy CodeThe code is as follows:
Now see if we have a file icon
if ((Isset ($_files[' icon ')) (Substr_count ($_files[' icon ' [' type '], ' image/'))) {
$prefix = "activity/". $activity->guid;
$filehandler = new Elggfile ();
$
The process is as follows:
First, the entity is saved using this method (the system itself):
For example, there is an activity class that inherits from Elggobject and creates an instance of its activity,
Copy Code code as follows:
Now if we have a file icon
if ((Isset ($_files[' icon ')) (Substr_count ($_files[' icon '] [' type '], ' image/')) {
$prefix = "activity/". $activity->guid;
$filehandler = new Elggfile ();
$
Four, Logger objectIn the above examples we have learned about Logging.debug (), Logging.info (), logging.warning (), Logging.error (), logging.critical () (used to record different levels of log information), Logging.basicconfig () (using the default log format (Formatter) to establish a default stream processor (Streamhandler) for the log system, Set the base configuration (such as log level, etc.) and add to root logger (root logger) These several logging module-level functions, plus a mo
Handler class typically uses the Logmanager property to set the default values for the Filter, Formatter, and level of the Handler.
Java.util.logging.Handler
Java.util.logging.MemoryHandler
Java.util.logging.StreamHandler
Java.util.logging.ConsoleHandler
Java.util.logging.FileHandler
Java.util.logging.SocketHandler Example: public class Testlogger {
public static void Main (string[] args) throws IOException {
Logger log = Logger.getlogger ("Lavasoft");
Log.setlevel (Level.info);
Logger log1 = L
instance; private static LruCache
When cache is a problem, you can see the following code to solve it:
/*** Image downloader class **/public class ImageDownLoad {private static final String TAG = "ImageDownLoad"; ImageDownloadListener mListener = null; private static int ALIVE_TIME = 30; // number of core threads private static int CORE_SIZE = 5; // maximum number of tasks private static int MAX_SIZE = 15; private static ArrayBlockingQueue
Then, the download is involved.
/*** File Dow
class TestLogger {public static void main (String [] args) throws IOException {// create a Logger severeLogger = Logger at the SEVERE level. getLogger ("logger. severe "); // The name is logger. severe severeLogger. setLevel (Level. SEVERE); // set the logger level // create a WARNING level Logger warninglogger = Logger. getLogger ("logger. warning "); warninglogger. setLevel (Level. WARNING); // create the INFO-level Logger infoLogger = Logger. getLogg Er ("logger.info"); infoLogger. setLevel
classpath.# by default We only configure a consolehandler, which'll only# show messages at the INFO and above levels.handlers= Java.util.loggin g.consolehandler# to also add the Filehandler with the following line instead. #handlers = Java.util.logging.FileHandler, ja va.util.logging.consolehandler# Default Global Logging level.# This specifies whichKinds of events is logged across# all loggers. For any given facility this global level# can is overr
code to solve it:
/*** Image downloader class **/public class imagedownload {Private Static final string tag = "imagedownload"; imagedownloadlistener mlistener = NULL; Private Static int alive_time = 30; // number of core threads Private Static int core_size = 5; // maximum number of tasks Private Static int max_size = 15; private Static arrayblockingqueue
Then, the download is involved.
/*** File Download *** @ author kyson **/public class filedownload {Private Static final int status_ O
(), Logger. warning (), Logger. error (), getLogger (), etc. Logger supports hierarchical Inheritance. the name of the sub-logger is usually the parent logger. name. If you do not create a logger instance, use the default root logger to get the root logger instance through logging. getLogger () or logging. getLogger.
Handler: Handler is used to process information output. it can output information to the console, file, or network. You can use Logger. addHandler () to add handler to a logger o
property to set the default values for the Filter, Formatter, and level of the Handler. Java.util.logging.HandlerJava.util.logging.MemoryHandlerJava.util.logging.StreamHandlerJava.util.logging.ConsoleHandlerJava.util.logging.FileHandlerJava.util.logging.SocketHandler Example: PublicclassTestlogger { PublicStaticvoidMain (string[] args)throwsIOException {Logger log = Logger.getlogger ("Lavasoft");Log.setlevel (Level.info);Logger log1 = Logger.getlogger ("Lavasoft");System.out.println (LOG==LOG1)
" "net/http")func main() { // Simple static webserver: port := ":8080" log.Printf("Serving at: http://localhost%s\n", port) err := http.ListenAndServe(port, http.FileServer(http.Dir("public"))) if err != nil { log.Fatal("ListenAndServe fail:", err) }}
One more executable file. tools/serve
#!/bin/bashexec go run tools/serve.go
OK now you just need to tools/serve start this server.
404
Everything looks normal, but if we visit a page that does not exist, 404.html will no
1. Let the data and the display separate Test.xml data:
Test title
Test Content
Banner
Sidebar
main body
end
of the page
Test.xslt templates:
test Link rel= "stylesheet" "type=" "Text/css" "href=" "Test.css" ">
]]>
2. The Web page automatically generates a PHP program to read the co
object can add 0 to multiple handler using the addHandler method, and each handler can define different log levels to achieve hierarchical log filtering and display.
Filter: provides an elegant way to determine whether a log record is sent to handler.
Formatter: specify the specific format of log output. The formatter constructor requires two parameters: the message format string and the date string. Both parameters are optional.
Similar to log4j, the calling of logger, handler, and log me
add 0 to multiple handler through the AddHandler method, and each handler can also define different log levels for the log rating filtering display.
Filter: Provides an elegant way to determine whether a log record is sent to handler.
Formatter: Specifies the specific format of the logging output. The formatter method requires two parameters: the format string of the message and the date string, both of which are optional.
Similar to log4j, calls to Logger,handler and log messages can
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.